Deliver Your Java Application in One-JAR™!

Copyright 2004-2010 by P. Simon Tuffs, All Rights Reserved. http://www.simontuffs.com




Options and VM Properties

To see what options are supported by One-JAR use the --one-jar-help command line option on a One-JAR file:

$ java -jar one-jar-example-0.97.jar --one-jar-help
One-Jar uses the following command-line arguments
    --one-jar-help    Shows this message, then exits.
    --one-jar-version Shows the version of One-JAR, then exits.

One-Jar uses the following VM properties (-D=)
    one-jar.main.class      Specifies the name of the class which should be executed
                            (via public static void main(String[])
    one-jar.record          true:  Enables recording of the classes loaded by the application
    one-jar.jar.names       true:  Recorded classes are kept in directories corresponding to their jar names.
                            false: Recorded classes are flattened into a single directory.
                            Duplicates are ignored (first wins)
    one-jar.verbose         true:  Print verbose classloading information
    one-jar.info            true:  Print informative classloading information
    one-jar.statistics      true:  Shows statistics about the One-Jar Classloader
    one-jar.jar.path        Full path of the one-jar file being executed.
                            Only needed if java.class.path does not contain the path to the jar, e.g. on Max OS/X.
    one-jar.class.path      Extra classpaths to be added to the execution environment.
                            Use platform independent path separator '|'
    one-jar.expand.dir      Directory to use for expanded files.
    one-jar.show.properties true:  Shows the JVM system properties.

Version information is presented as a single line response. For example: One-JAR version 0.97-rc11-20100715-0959 The major version number is 0.97, the minor version number is rc11 (release-candidate 11), built on July 15, 2010 at 9:59.

To see what the JarClassLoader is doing behind the scenes, enable verbose output using the one-jar.verbose system property:

$ java -Done-jar.verbose=true -jar one-jar-example-0.97.jar
JarClassLoader: One-Jar-Expand=expand,doc,file.txt
JarClassLoader: Info: resource: one-jar-example-0.97.jar!META-INF/MANIFEST.MF
JarClassLoader: cached bytes for class OneJar.class
JarClassLoader: cached bytes for class com.simontuffs.onejar.Boot.class
JarClassLoader: cached bytes for class com.simontuffs.onejar.Handler$1.class
JarClassLoader: cached bytes for class com.simontuffs.onejar.Handler.class
JarClassLoader: cached bytes for class com.simontuffs.onejar.IProperties.class
JarClassLoader: cached bytes for class com.simontuffs.onejar.JarClassLoader$1.class
JarClassLoader: cached bytes for class com.simontuffs.onejar.JarClassLoader$ByteCode.class
JarClassLoader: cached bytes for class com.simontuffs.onejar.JarClassLoader.class
JarClassLoader: Info: resource: one-jar-example-0.97.jar!OneJar.java
JarClassLoader: Info: resource: one-jar-example-0.97.jar!boot-manifest-external.mf
... many more lines until the first line of output from the Main class.
This diagnostic output can prove useful when trying to debug class-loading issues.

If you like One-JAR then you might want to check out some of the other Open-Source projects developed by simontuffs.com:
Get One-JAR(TM) at SourceForge.net. Fast, secure and Free Open Source software downloads soap-stone at sourceforge.net Eclipse JAR Plugin Yet Another Compiler Compiler Language