-
Bug
-
Resolution: Fixed
-
P4
-
17.0.6, 20
-
b08
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8315654 | 21.0.1 | Paul Hohensee | P4 | Resolved | Fixed | b10 |
JDK-8315727 | 17.0.10-oracle | Alexey Semenyuk | P4 | Resolved | Fixed | b01 |
JDK-8316120 | 17.0.10 | Paul Hohensee | P4 | Resolved | Fixed | b01 |
Windows 10 and Linux OpenJDK20
A DESCRIPTION OF THE PROBLEM :
jpackage with multiple module launchers crashes unless the command line contains a trivial / unnecessary module path.
Note that this bug is similar to the report mentioned in
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
I have a large project with multiple modules, I built a JRE with jlink that contains every module used and pass that JRE to jpackage command so that no additional modules are required by jpackage. Fortunately I can reproduce simply by calling jpackage with a classname of module "java.base" and with the standard OpenJDK20 runtime. On WIndows / Linux start in empty directory:
mkdir THIS_ISNT_NEEDED_BUT_JPACKAGE_FAILS_WITHOUT_IT
Create a launcher specifying module from a package found in the runtime image (java.base in this case)
echo module=java.base/classdoesnotmatter > launcher.properties
On Windows I use OpenJDK as the runtime parameter - C:\java\jdk-20
jpackage --name "TEST" --runtime-image C:\java\jdk-20 --type app-image --module java.base/classnotimportant --dest jpackage0.out
jpackage --name "TEST" --runtime-image C:\java\jdk-20 --type app-image --module java.base/classnotimportant --add-launcher another=launcher.properties --dest jpackage1.out
jpackage --name "TEST" --runtime-image C:\java\jdk-20 --type app-image --module java.base/classnotimportant --add-launcher another=launcher.properties --dest jpackage2.out --module-path THIS_ISNT_NEEDED_BUT_JPACKAGE_FAILS_WITHOUT_IT
On Linux I use OpenJDK as the runtime parameter - /mnt/c/linux/jdk-20
jpackage --name "TEST" --runtime-image /mnt/c/linux/jdk-20 --type app-image --module java.base/classnotimportant --dest jpackage3.out
jpackage --name "TEST" --runtime-image /mnt/c/linux/jdk-20 --type app-image --module java.base/classnotimportant --add-launcher another=launcher.properties --dest jpackage4.out
jpackage --name "TEST" --runtime-image /mnt/c/linux/jdk-20 --type app-image --module java.base/classnotimportant --add-launcher another=launcher.properties --dest jpackage5.out --module-path THIS_ISNT_NEEDED_BUT_JPACKAGE_FAILS_WITHOUT_IT
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
All 6 jpackage commands should generate app-image structure as the JRE runtime supplied contains the required module "java.base" that was specified by each launch configuration. [Obviously these apps won't run as the classnames are made up]
ACTUAL -
Two of the commands fail - runs for jpackage1.out and jpackage4.out both crash with exception:
java.lang.ClassCastException: class java.util.ImmutableCollections$List12 cannot be cast to class java.lang.String (java.util.ImmutableCollections$List12 and java.lang.String are in module java.base of loader 'bootstrap')
CUSTOMER SUBMITTED WORKAROUND :
The workaround is to supply `--module-path` for an empty directory. That gets copied into the release and every launcher contains these unnecessary lines:
java-options=--module-path
java-options=$APPDIR\mods
FREQUENCY : always
- backported by
-
JDK-8315654 jpackage does not work for module projects unless --module-path is specified
- Resolved
-
JDK-8315727 jpackage does not work for module projects unless --module-path is specified
- Resolved
-
JDK-8316120 jpackage does not work for module projects unless --module-path is specified
- Resolved
- duplicates
-
JDK-8306488 When running jpackage and adding `--add-launcher`, it throws `ClassCastException`.
- Closed
- links to
-
Commit openjdk/jdk17u-dev/4e9b6da2
-
Commit openjdk/jdk21u/b86a0ce1
-
Commit openjdk/jdk/dfe764e3
-
Review openjdk/jdk17u-dev/1717
-
Review openjdk/jdk20u/86
-
Review openjdk/jdk21/140
-
Review openjdk/jdk21u/120
-
Review openjdk/jdk/14840