HOW TO BUILD AN EXE WITH JPACKAGE
1.Create the jar file
Here is a valid jar build command.
cd %PATH-TO-DIRECTORY% jar cfve %application.jar% bin %bin% %...%
where %PATH-TO-DIRECTORY% can be for example c:/Users/Michael
%application.jar% the output file created
%...%everything you want to include in the jar
2. Creating the exe:
Make sure you include in the command the --main-class statement. Otherwise the executable would encounter a runtime exeption.
Here is an example exe build command for a javafx app
cd C:\Users\John\Documents\java\application\build && jpackage --input C:\Users\John\Documents\java\application\build ^ --name MyApp ^--main-jar myapp.jar ^--main-class app.MyApp ^--type exe ^ --dest C:\Users\John\Documents\installers ^--icon C:\Users\John\flower.ico ^ --add-modules javafx.controls,javafx.fxml,javafx.graphics,javafx.base,javafx.swing ^ --win-menu ^ --win-dir-chooser ^ --java-options "-Dprism.verbose=true" ^ --java-options "-Djavafx.verbose=true" ^ --java-options "-Dprism.order=sw" ^ --java-options "-Dprism.order=d3d"
where you dont need to include the arguments from "-dest (destination folder)" This would build an installer with directory installation choose.