Search code examples
javajavafxjlinkjpackage

Created .exe from jpackager crashes


I have a JavaFX Project, which I want to export as a dmg and exe. The export as a dmg file for Mac was no problem. But the export as a .exe file for Windows is not working. I created a jar file and I ran jlink. Then I exported the project with jpackage. Here is the command:

/path/to/jpackage \
--input %PATH_TO_SDK%/lib/  \
--name "My Project" \
--main-jar /path/to/jar.jar \
--main-class com.company.project.Main \
--type exe \
--add-modules javafx.controls,javafx.fxml,javafx.graphics \
--module-path %PATH_TO_SDK%/lib/

On my machine, it is working perfect, but on others (I tested it on two more machines (they do not have Java(FX) installed)) the CMD window crashes instantly.


Solution

  • After a lot of research, I found a GitHub repo which shows how to create dmg and exe files. Maven jPackage Template