Creating native runtime image with jlink

Could not find any posts regarding building with Java 9+ to create native runtime images.
I thus started writing this topic to check among you what you where using to build your Java 9+ applications.

I was also doing some investigation what is out there of support for Gradle and what people was using.
Here is my findings on the subject. Please chime in you have additional information and approaches.

Pre-Java 9 we have the javapackager and javafx-gradle-plugin to create a native runtime image.
It might still be used for projects that aren’t yet modularized, but the javapackager is scheduled for removal.

If the application is modularized the tool to use is now jlink.
One could always just make an Exec task to run jlink, but I think most prefer a plugin.
in that regard I have found two plugins for gradle:


Danny Althoff has created a new gradle plugin to replace his javafx-gradle-plugin. However it is still a work in progress.
1 Like

Hi,

I’m the author of the JpmsGradlePlugin. I checked in support for creating application bundles for modularized Java 11 projects just yesterday (version 0.8.0). Until now, I could only test it on Mac though. If you want, just give it a try and report back any issues you have.

You have to have jpackager on the path when creating bundles, download here:

http://download2.gluonhq.com/jpackager/11/jdk.packager-linux.zip
http://download2.gluonhq.com/jpackager/11/jdk.packager-osx.zip
http://download2.gluonhq.com/jpackager/11/jdk.packager-windows.zip

No need to use those from gluonhq, it is no longer up to date.
Download an JDK 13 EA with jpackage https://jdk.java.net/jpackage/
You would need to create a Java 11 runtime image first to use with jpackage.

The tool jpackage is now available with JDK 14+.