error using jlink to customize the OpenJDK JRE

Doug Whitfield dwhitfield at perforce.com
Thu Mar 16 14:23:30 UTC 2023


I tried sending this to the dev mailing list yesterday but it looks like it never went through. I’m not sure if the dev list is just for committers or what. Maybe it will come through eventually.

I would like to use the java tool jlink to create a customized JRE within our own compiled OpenJDK version.

I use this guide to compile my OpenJDK version 17:
https://wiki.openjdk.org/display/OpenJFX/Building+OpenJFX

The used version is: git clone https://github.com/openjdk/jfx17u

Basically the compilation (bash configure, and make images) is successful and I am able to run java.

bash configure –with-boot-jdk=/cygdrive/c/jdk1602
make images

openjdk at debian10-uni:~/Java17/jdk17u/build/linux-x86_64-server-release/jdk/bin$ ./java -version
openjdk version "17.0.7-internal" 2023-04-18
OpenJDK Runtime Environment (build 17.0.7-internal+0-adhoc.openjdk.jdk17u)
OpenJDK 64-Bit Server VM (build 17.0.7-internal+0-adhoc.openjdk.jdk17u, mixed mode)

Now I use jlink to customize the JRE. The command is this one:

openjdk at debian10-uni:~/Java17/jdk17u/build/linux-x86_64-server-release/jdk/bin$ ./jlink —add-modules java.base —module-path ../../images/jmods —output my-jre
The result is this:
Error: java.io.UncheckedIOException: java.nio.channels.ClosedChannelException

If I replace the module java.bases with "—add-modules ALL-MODULE-PATH" then the result is this:
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
Error: java.io.UncheckedIOException: java.nio.channels.ClosedChannelException


Doing the same with a pre-compiled version https://jdk.java.net/archive ((build 17.0.2+8) then jlink is working fine and it creates my-jre and the command "java -version" runs successfully.
I tried already to use jlink from the downloaded JDK and the jmods from my compiled version. This is working as well. But using jlink from my own compiled version with jmods from the download JDK does not work.

Do you have an idea, what’s wrong there? Does jlink have a bug in 17.0.7? How can I overcome this problem? Is there a better place to ask this question? Would any additional information be useful?


This e-mail may contain information that is privileged or confidential. If you are not the intended recipient, please delete the e-mail and any attachments and notify us immediately.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-discuss/attachments/20230316/42c3dfc5/attachment.htm>


More information about the openjfx-discuss mailing list