After creating a jar with "mvn package", I use this command in order to create an installer from the jar:
jpackage --verbose --name project_executable_name --input target --main-jar ProjectJAR.jar --main-class com.example.MainClass --win-console
When trying to double click the project executable (.exe created by jpackage), it doesn't open. When running it from cmd, I get this error message:
C:\Program Files\project_executable_name>project_executable_name.exe Error: JavaFX runtime components are missing, and are required to run this application
Oddly, if I double click the jar (which is the one used by jpackage in order to create the program image), it launches my app. Same for java -jar. The program runs successfully when used "Run" button from intellij and mvn javafx:run as well. In order to run from intelliJ, the following VM Arguments are necessary:
--module-path /Users\UserName\Documents\javafx-sdk-15\lib
--add-modules=javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web
The program runs from multiple sources, but it doesn't work with jpackage for some reason. Any ideas?