Preparing OS-native installers with javapackager

Once we have a JAR, we can create a self-containing application using the -deploy command with the -native parameter:

"$JAVA_HOME/bin/javapackager" -deploy -native -verbose -appclass chapterEleven.SimpleApp -outdir dist-native  -outfile SimpleApp -srcdir dist -srcfiles SimpleApp.jar -appclass chapterEleven.SimpleApp -name SimpleApp

Parameters are similar to the JAR creation routine, but we need to provide a JAR here as a source.

javapackager may ask you to install additional software to run properly. For example, on Windows you'll need to have the following applications:

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.