7

I'm using JPackage (OpenJDK 15.0.1) to make a portable executable file for Windows. I tried the command below, but I double-clicked the generated exe file and the installer window was displayed. It seemed that it was not portable executable but just installer.

jpackage --name "Test App" --vendor "com.example" --type exe --input input --main-jar test-app-1.0.jar --main-class main.Main

Is there any way to make a executable file that can be used without installing using JPackage?

ryo
  • 73
  • 4

1 Answers1

6

If by 'portable executable' you mean a single self-contained executable, then this is currently not possible to do.

What you can do if you want an executable that can run the program directly without installing, is use the --type app-image flag, which will create an application image that contains a .exe launcher to launch the app.

Jorn Vernee
  • 31,735
  • 4
  • 76
  • 93
  • 1
    Yes, I meant a single self-contained executable. `--type app-image` option fits to what I want to do enough. Thank you for telling me that. – ryo May 19 '21 at 14:13
  • This works for me, but when launching the app, occur the popup error: *Failed to launch JVM.* I generated the app with the command: `jpackage --type app-image --dest .\target\jpackage --input .\target\bundles\my-app --main-jar 'my-app-1.0-SNAPSHOT.jar' --jlink-options --bind-services --verbose` – Fabrício Pereira May 25 '23 at 16:03