From dwhitfield at perforce.com Thu Mar 16 14:23:30 2023 From: dwhitfield at perforce.com (Doug Whitfield) Date: Thu, 16 Mar 2023 14:23:30 +0000 Subject: error using jlink to customize the OpenJDK JRE Message-ID: 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: From kevin.rushforth at oracle.com Thu Mar 16 16:05:46 2023 From: kevin.rushforth at oracle.com (Kevin Rushforth) Date: Thu, 16 Mar 2023 09:05:46 -0700 Subject: error using jlink to customize the OpenJDK JRE In-Reply-To: References: Message-ID: <88951c05-98af-7727-d51f-ad5f05b3a478@oracle.com> 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: