0

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?

hiddeneyes02
  • 2,562
  • 1
  • 31
  • 58

1 Answers1

0

AFAIK JavaFX was never directly part of the JRE/JDK. It had to be installed separately. Did you include the JavaFX code inside your jar, or reference it via the classpath? (note, a classpath can even be set inside the MANIFEST). If it is an external file, is this external file accessible to JPackage?

Queeg
  • 7,748
  • 1
  • 16
  • 42