Page tree
Skip to end of metadata
Go to start of metadata


The Java Runtime Environment supports running a Jar file using the following syntax:

$ java -jar bundle.jar

The only requirement of the bundle.jar file is that it contains a manifest attribute Main-Class which defines a main class to run, for instance in the META-INF/MANIFEST.MF file:

Example of Main-Class attribute in META-INF/MANIFEST.MF file
Main-Class: org.nsys.daemon.server.embedded.ServerLauncher

Any non-trivial Java application is going to rely on any number of supporting Jar files. For example, using the Apache Log4j Logging capability to do logging an application will need to have the log4j.jar file on its classpath. Unfortunately the Java Launcher$AppClassLoader does not know how to load classes from a Jar inside a Jar. Trying to use jar:file:bundle.jar!/log4j.jar also leads down a dead-end. This approach will only work if you install the supporting the Jar files into the directory where the bundle.jar file is installed.

Another approach is to unpack all Jar dependencies and repack them inside the bundle.jar file. This approach tends to be fragile and slow, and can suffer from duplicate resource issues.

The Nsys-Boot uses its own classloader BootClassLoader which loads classes and resources from main Jar file (in manifest it's defined by attribute Nsys-Boot-SystemLoader) together with all dependencies into memory providing much faster response in compare with loading from file directly.

  • No labels