Doug Whitfield

Doug Whitfield at

I would like to use 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@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@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?