JavaFX 8: Simplest Native Packaging using Netbeans 8 and Ant Tasks

1 min read
The reason I am writing this blog post is that I didn't find any short example about Native Packaging in JavaFX 8. Most of them were too long and too confusing. This blog post aims to close this gap.

At times of Swing the final artifact of a Swing build was still a jar and native installers out of the box were a dream. Since JavaFX it is possible to create native packages. The results are operating system specific installers. For Windows this will be .msi or .exe, on a linux platform the installers are .deb for the debian based distributions and .rpm for the Red Hat based ones.

NetBeans 8.x provides a great native packaging support for JavaFX 8 Apps. The easiest way to create such installable applications in JavaFX using NetBeans 8.x is creating a simple JavaFX project with the following project wizard (File -> New Project):

This choice will result in an ant based JavaFX project. Ant in my opinion is really outdated, but for this simple task of creating operating system related installers it is the easiest and fastest way using NetBeans.

After creating such an ant project in NetBeans, you simply have to enable native packaging by choosing properties at the context menu of the created project. After that you have to enable the packaging like in this figure:


The last step after enabling native packaging is right-clicking the project root, choosing the "Package as" menu entry and selecting your operating system respective installer like: deb, exe and so on.

The result of clicking a native package could be found at the dist directory of the JavaFX project in the NetBeansProjects workspace.

Have fun with installing your JavaFX Apps at different platforms :-)

PS: watch the build with patience. Building installers is not as fast as building jars.



Be Social, Share!