Search code examples
javakotlinjpackage

jpackage not working on Windows 10 and JDK 16


trying to use jpackage for one of my projects, but does not work, crashing with a 103 error code.

Command: jpackage.exe --main-jar evomaster.jar --input core/target/ --type msi

Error:

java.io.IOException: Command [C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe, -nologo, -spdb, -ext, WixUtilExtension, -out, C:\Users\arcur\WORK\code\EvoMaster\Main-1.0.msi, -sice:ICE27, -loc, C:\Users\arcur\AppData\Local\Temp\jdk.jpackage3073169401587857747\config\MsiInstallerStrings_en.wxl, -cultures:en-us, C:\Users\arcur\AppData\Local\Temp\jdk.jpackage3073169401587857747\wixobj\main.wixobj, C:\Users\arcur\AppData\Local\Temp\jdk.jpackage3073169401587857747\wixobj\bundle.wixobj] in C:\Users\arcur\AppData\Local\Temp\jdk.jpackage3073169401587857747\images\win-msi.image\Main exited with 103 code

JVM: openjdk version "16" 2021-03-16 OpenJDK Runtime Environment AdoptOpenJDK (build 16+36) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 16+36, mixed mode, sharing)

OS Name Microsoft Windows 10 Pro Version 10.0.18363 Build 18363

Any clue (of what I am doing wrong) or workaround (if someone has already faced this problem)?

UPDATE:

after the suggestion of Jorn Vernee, I ran the light command directly, to see the error messages. it is full of:

C:\Users\arcur\WORK\code\EvoMaster\foo\config\bundle.wxf(14413) : error LGHT0103 : The system cannot find the file 'C:\Users\arcur\WORK\code\EvoMaster\foo\images\win-msi.image\Main\app\classes\org\evomaster\core\search\service\Archive$sortAndShrinkIfNeeded$inlined$thenBy$2.class'.

what all these error messages have in common is that they are related to inlined classes. The program is written in Kotlin, and the Jar is built with maven-assembly-plugin


Solution

  • thanks to a discussion on Reddit I found a solution: you need to take your app.jar file out of the target folder, and put it in a folder (e.g., foo) that has only that file. then, use this new folder for the --input command.

    The source of the problem seems light.exe not liking file paths that are too long... but all the other files under target are unnecessary when dealing with a uber-jar.