问题
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)
回答1:
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).
来源:https://stackoverflow.com/questions/64744154/jpackage-crashes-when-creating-an-installer-with-the-app-image-option