Creating native runtime image with jlink


(Sverre Moe) #1

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.