javamacosjavapackager

How can I specify a classpath for executables created with javapackager?


The javapackager command in Java 8 is able to create standalone executables. The examples on the web usually only use a single jar file, but I have several jar files that need to be bundled into the application. The documentation states that it is possible to tell the bundler the classpath sending classPath=path through the -B option. However, in the resulting <applicationname>.cfg file inside the packaged application there is a line that says

app.classpath=

which is not affected at all by the classPath argument, but I have to manually edit it to include all the jars used by the app to make it work.

All this is on macOS, I couldn't try it on another platform yet.

Any insight greatly appreciated – a working example using more than one jar, for example.


Solution

  • The documentation is slightly flawed:

    -Bclasspath=
    

    with small p instead of capital P works (Tested on Windows and MacOS).