Let's say I'm developing a modular application that consists of 2 modules: com.spacey.explorer
that depends on com.spacey.rocket
module. I have their modular JAR files in some bin
directory.
And I want to prepare lightweight JRE to run it. So obviously, I use the jlink tool:
$ jlink --module-path /opt/jdk-9/jmods:../bin --add-modules com.spacey.explorer --output ~/custom-jre3
Now when I list modules in my JRE I get the following:
$ java --list-modules
com.spacey.explorer
com.spacey.rocket
java.base@9
That is, my application modules are bundled into JRE. But if I wanted to build a JRE that has just JDK-originated modules that are sufficient to run my application and keep my application modules separate, I have to know what my JDK dependencies are (in the example this is just java.base
) and specify them explicitly like:
$ jlink --module-path /opt/jdk-9/jmods --add-modules java.base --output ~/custom-jre3
Is there any way to make jlink do this for me ? Or any tool that would figure out those JDK-originated dependencies for me?