4

I'm trying to use jpackage to create an installer for my Java app. I'm on Windows 10 using OpenJDK 15.0.1. I can build an installer using

jpackage --input C:\MyApp --main-jar MyApp.jar

This basically works, but the installed application lacks resource files. According to the documentation, I should be able to build an app image, add my resource files to the image, then build the installer from the modified app image, as follows

cd C:\MyApp
mkdir build
copy MyApp.jar build
jpackage --type app-image --n MyAppImage --input C:\MyApp\build --main-jar MyApp.jar
copy <resource files> MyAppImage
jpackage --app-image MyAppImage --name MyAppInstaller

This builds MyAppImage, but when I run jpackage --app-image it crashes. Here's the output:

WARNING: Using incubator modules: jdk.incubator.jpackage
java.io.IOException: Command [C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe, -nologo, -spdb, -ext, WixUtilExtension, -out, C:\Users\Jerry\AppData\Local\Temp\jdk.incubator.jpackage10106877493523723400\images\win-exe.image\MyAppInstall-1.0.msi, -sice:ICE27, -loc, C:\Users\Jerry\AppData\Local\Temp\jdk.incubator.jpackage10106877493523723400\config\MsiInstallerStrings_en.wxl, C:\Users\Jerry\AppData\Local\Temp\jdk.incubator.jpackage10106877493523723400\wixobj\main.wixobj, C:\Users\Jerry\AppData\Local\Temp\jdk.incubator.jpackage10106877493523723400\wixobj\bundle.wixobj]in C:\Users\Jerry\AppData\Local\Temp\jdk.incubator.jpackage10106877493523723400\images\win-msi.image\MyAppInstall exited with 103 code

Has anyone else encountered this? What should I try?

(This is a follow-up to an earlier post)

Jorn Vernee
  • 31,735
  • 4
  • 76
  • 93
Jerry Agin
  • 629
  • 1
  • 5
  • 15
  • You might get more useful output by manually running the failing command. To get the temporary files you need, you could use the jpackage `--temp` option to specify a local directory for putting temporary files. – Jorn Vernee Nov 09 '20 at 00:30

1 Answers1

3

Seems to be: https://bugs.openjdk.java.net/browse/JDK-8254783

jpackage fails on Windows when application name differs from installer name

I could reproduce your crash with JDK 15 build 36.

It works for me if I specify the same argument to --name is I specified for the app image. In your case the working command should be:

jpackage --app-image MyAppImage --name MyAppImage

(The same name as for the app-image command, but you might want to change the name).

For what it's worth, this works in the latest JDK 16-ea. (See also the comments on the JBS issue).

Jorn Vernee
  • 31,735
  • 4
  • 76
  • 93
  • 2
    It turns out there are other problems with filenames. I used --name of build, and `jpackage --appimage` ran to completion, but the .exe installer would hang. It would only work when I used --name of myapp. IMHO jpackage is due for some major testing and debugging! – Jerry Agin Nov 10 '20 at 21:14