After creating the .exe
file using the command jpackage
, I'm getting the error Failed to launch JVM
when running the file. What is more weird is that I tried the same command (I keep a file with all the commands for easier use in future) for an older project that I know it was working because a few days ago I made it, and I'm now getting the same error.
The only change that I can think of is that I switched from Windows 10 to Windows 11, but Eclipse is running fine, as well as all my developing tools, and all the other programs that I made in the past (which they should, as all the required files are local to the their folder, the way jpackage
works).
When running the command I'm not getting any errors, the .exe
file is created and the installation doesn't have any problems.
What can be the cause of it and what should I do? I've seen a different thread and someone suggested to that person to use --win-console
and to tell what he sees if anything, but if I use that instead of --win-menu
, a terminal window is opened and closes without any output inside it.
jpackage -t exe --name "Exe Name"
--vendor "Vendor Name"
--app-version 1.0
--input "Location of the jar file"
--dest "Where the exe for installation to be placed, I normally use same as jar for organization reason"
--main-jar "Jar Name.jar"
--icon "Location of the icon file.ico"
--module-path "Where the jmods are located, downloaded from https://openjfx.io"
--add-modules javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web --win-shortcut --win-menu
I'm now using Eclipse Adoptium for both JDK as well as JRE. Also I downloaded the jmods from JavaFX Gluon website. Right now I'm using version 17 which has the longest LTS for now.
These are the steps that I did to make it work:
jpackage -t exe
--name "Application Name"
--vendor "Your company name"
--app-version 1.0
--input "C:\Programs\Test program"
--dest "C:\Programs\Test program"
--main-jar "Application Name.jar"
--icon "C:\Programs\Test program\Application Name.ico"
--module-path "C:\Program Files\Eclipse Adoptium\jdk-17.0.7.7-hotspot\jmods"
--add-modules javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web,jdk.localedata
--win-shortcut --win-menu
Hope this will help someone who had the same problem as my, and after running jpackage they were getting Failed to launch JVM error.