I was looking for a method to distribute JavaFX programs to others without requiring them to install the necessary Java runtime and JavaFX SDK prerequisites or compile the project's source code themselves. While exploring e(fx)clipse, I discovered that although it provided an autogenerated Ant build file, it was outdated, relied on the obsolete javapackager
tool, and simply didn't work with modern JavaFX projects.
Since I preferred not use Maven, Gradle, or another third-party plugin just to package the project that I'm working on, I opted to create my own Ant build file. This should be compatible with the jlink
and jpackage
tools. However, it's worth noting that this approach will likely only work with Java 14 and above, as that's when the jpackage
tool was introduced."
- Copy the entire
/build
directory to your JavaFX project. - If you are using Eclipse, you can either run the Ant build from the primary toolbar or right-click on the
build.xml
file in the Project Explorer list, select Run As, and chooseAnt Build
. - Note that
jpackage
might require WiX to be installed.