error using jlink to customize the OpenJDK JRE

Kevin Rushforth kevin.rushforth at oracle.com
Thu Mar 16 16:05:46 UTC 2023


I'm not sure what the exception is, but I see two things you might want 
to try:

1. It seems like a bad idea to set the destination dir for jlink to be 
within the JDK you are running jlink from. This is the most likely 
source of the error.

2. I don't see where you are pointing to the JavaFX modules.

I would recommend running something like the following, from some 
directory that not inside .../images/jdk

.../images/jdk/bin/jlink --output myjdk --module-path 
.../images/jmods:.../javafx-jmods-17.0.7 --add-modules ALL-MODULE-PATH

-- Kevin


On 3/16/2023 7:23 AM, Doug Whitfield wrote:
>
> 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/760d6a87/attachment-0001.htm>


More information about the openjfx-discuss mailing list