adoptium / temurin-build

Eclipse Temurin™ build scripts - common across all releases/versions
Apache License 2.0
1k stars 243 forks source link

Temurin 17 JRE builds are missing modules (jdk.unsupported.desktop, jdk.random) #2883

Open anctilg opened 2 years ago

anctilg commented 2 years ago

What are you trying to do? Using JavaFX 17's swing integration, which is using the jdk.unsupported.desktop in conjunction with OpenJDK17U-jre_x64_windows_hotspot_17.0.2_8

Expected behaviour: The module is available and the application that uses Java FX 17's swing integration with the JRE build does not crash. It should work just fine, just like it does on the JDK build (OpenJDK17U-jdk_x64_windows_hotspot_17.0.2_8)

Observed behaviour: The module is not available in the modules file of the build, and an application that makes use of jdk.unsupported.desktop crashes when using the JRE build, while it does not when using the JDK build.

Any other comments: Both the OpenJDK17U-jdk_x64_windows_hotspot_17.0.2_8 & OpenJDK17U-jre_x64_windows_hotspot_17.0.2_8 builds have a "release" file at the root of the JDK/JRE folder. Both files are identical except for the IMAGE_TYPE line.

So both release files indicate the jdk.random and jdk.unsupported.desktop modules as available on the MODULES line.

If you run jimage list ..\lib\modules on both builds and compare the output, you can clearly see that the list differs from the list in the "release" file on the JRE build. The JRE build is missing a few modules that are of limited use on a JRE, which is fine, but both jdk.random and jdk.unsupported.desktop should be included and they are not.

I see two issues here: 1) the "release" file that lies about the contents of the release on the MODULES line 2) The missing inclusion of both jdk.random and jdk.unsupproted.desktop modules in the JRE builds.

Related to this is this bug for jdk.random on ALPINE: https://github.com/adoptium/temurin-build/issues/2843

anctilg commented 2 years ago

Additional information:

The Azul Zulu JRE build zulu17.32.13-ca-jre17.0.2-win_x64 contains jdk.random in its modules file, but not desktop.unsupported. Their "release" file does not contain the jdk.unsupported.desktop module in their MODULES line.

They do provide a JRE + JavaFX build, but that build does not include the javafx.swing module, and does not include the jdk.unsupported.desktop module either (which would be required by javafx.swing)

jensli commented 1 year ago

Work-around: It is easy to use jlink to build a custom JRE from a Temurin JDK.

jdk-17.0.7+7/bin/jlink --strip-debug --compress=2 --output=custom-jre --add-modules=java.se,jdk.unsupported.desktop,jdk.unsupported,jdk.random

If you try to start your application and get the following errors you can add more modules:

Error occurred during initialization of boot layer java.lang.module.FindException: Module jdk.jsobject not found, required by javafx.web

See this for more: https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/

karianna commented 1 year ago

I suspect this is because we defaulted to using the same modules as the legacyJre target.

@hendrikebbers Are you able to comment here?

rkraneis commented 7 months ago

This is still an issue with at least eclipse-temurin:21-jre-ubi9-minimal.

jensli commented 1 month ago

Any news here? It's a real disadvantage not to be able to use Temurin to run JavaFX applications.