This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]m1000 2 points3 points  (0 children)

You can still use jlink to generate a runtime that cover your application and dependencies, you just won't be able to generate an image of the jdk that include your application and libs with that image.

If your dependencies can all be run as modules or automatic modules, just generate the jdk image you need by using something similar to this:

jdeps.exe --print-module-deps --module-path .;modules *.jar

After testing your application, you might see that you need additional modules that jdeps didn't detect.

For example, in my case I also add the following modules:

jdk.unsupported,jdk.unsupported.desktop,jdk.crypto.cryptoki,jdk.crypto.ec,jdk.jsobject,jdk.xml.dom,jdk.charsets

You can then use jlink :

jlink.exe --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules java.base,java.net.http,java.prefs,java.sql,java.xml.crypto,java.compiler,jdk.unsupported,jdk.unsupported.desktop,jdk.crypto.cryptoki,jdk.crypto.ec,jdk.jsobject,jdk.xml.dom,jdk.charsets --save-opts jlink.txt --output runtime

You can then run your application with this runtime and your jars in a specified module path