Reputation: 780
I have successfully followed the instructions mentioned in openjfx-docs (using maven)
I'm able to run it in my eclipse. I'm also able to create custom runtime images using jlink. The application could be run through the generated launcher.
Now, how do we create a runnable jar/exe with the stripped down JRE generated by jlink?
Upvotes: 3
Views: 1640
Reputation: 71
I just recently started experimenting with the jlink
tool of Java 11 and can provide a partial answer. The java
command in the bin directory of a custom runtime image works just like java
of the standard JRE:
/path/to/custom/runtime/image/bin/java -jar myjar.jar
The custom runtime image must of course contain all the required dependencies, which I made sure by making myjar.jar a modularized JAR and by providing the switch
--add-modules myjar.jar
when creating the custom runtime image with jlink
. With the additional switch
--launcher mylaunchername=modulename.of.my.jar/mypackage.with.MainClass
the directly executable binary
/path/to/custom/runtime/image/bin/mylaunchername
is generated. On my Mac, I created an alias and moved that to the desktop. That's as close to an application as I could get so far, with the following caveats:
Upvotes: 1