mana
mana

Reputation: 1239

Java FX Application with Jpackage not work

I've created my Application in JavaFX. Everything works well, so I use the Jpackage to make a installable version of my application in Window.

After I install the package, the window computer still ask to install JVM.

jpackage -t exe --name "FReport" --description "Time reporting" --app-version 1.0 --input "C:\myapp" --dest "C:\myapp\out" --main-jar "freport.jar" --module-path "C:\Program Files\Java\javafx-sdk-17.0.1\lib" --add-modules javafx.controls,javafx.fxml --win-shortcut --win-menu

My expectation, that I can use Jpackage to install my JavaFX application on any computer and it automatically setup the JVM ..etc. The user just have to click on the icon and run the application.

Any suggestion on the correct command in Jpackage to pack my JavaFX application jar file with all the require environment like JVM ..etc

Upvotes: 0

Views: 1147

Answers (1)

DuncG
DuncG

Reputation: 15136

You have not specified the correct modules for JavaFX - you have referenced the lib files not modules so jlink won't contain the JavaFX libraries because it does not read the modules such as javafx.base.jmod. Download jmods JDK and reference C:\somepath\javafx-jmods-VER instead of the lib release.

Additionally: turn on console by adding --win-console and report back what the actual error messages are when your run the installer and the application EXEs.

You have specified --input with nested --dest inside, so you will get your whole application copied into the second release

Test your application with the installed runtime image, or as separate image (see below). Simply reference the installer location of jlink runtime with your current application to see which modules are missing.

If you don't update -app-version each time then the new package is NOT installed by any of the subsequent attempts unless you un-install the previous installation. This is very frustrating, jpackage ought to warn on re-install same version rather than give up with no error message.

Note all of these other typical jpackage issues:

Upvotes: 4

Related Questions