JDK-8232080 : jlink plugins for vendor information and command-line options
  • Type: Enhancement
  • Component: tools
  • Sub-Component: jlink
  • Affected Version: 11,14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-10-09
  • Updated: 2022-01-05
  • Resolved: 2019-10-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14
11.0.7-oracleFixed 13.0.4Fixed 14 b21Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
The jlink tool can already be used to create a custom run-time image, but some uses require additional customization:

  - If the resulting image is distributed to end users, it can be useful to change some of the vendor information, such as the vendor version string and the URLs for bug reports.

  - In some cases, the virtual machine in the resulting image must be started with additional, baked-in command-line options.

We’ll address these needs via a set of new jlink plugins which implement the following options:

  - --vendor-bug-url=<vendor-bug-url> overrides the vendor bug URL baked into the build.  The value of the system property "java.vendor.url.bug" will be <vendor-bug-url>.

  - --vendor-vm-bug-url=<vendor-vm-bug-url> overrides the vendor VM bug URL baked into the build.  This value will be displayed in VM crash logs.

  - --vendor-version=<vendor-version> overrides the vendor version string baked into the build, if any.  The value of the system property "java.vendor.version" will be <vendor-version>.  This value will be displayed in the output of java --version.

  - --add-options=<options> prepends the specified <options> string, which may include whitespace, before any other options when invoking the VM in the resulting image.

Example usage:

$ jlink --add-modules java.base --output /tmp/jre --vendor-version='XyzzyVM 3.14.15' --vendor-bug-url=https://bugs.xyzzy.com/ --add-options='-Dfoo=xyzzy'
$ /tmp/jre/bin/java -XshowSettings:properties --version 2>&1 | grep -i xyzzy
    foo = xyzzy
    java.vendor.url.bug = https://bugs.xyzzy.com/
    java.vendor.version = XyzzyVM 3.14.15
OpenJDK Runtime Environment XyzzyVM 3.14.15 (build 14-mr+0-cjdk-81d748451934)
OpenJDK 64-Bit Server VM XyzzyVM 3.14.15 (build 14-mr+0-cjdk-81d748451934, mixed mode)
$ 

Comments
Fix request (13u) I'd like to port it to 13u as well. Here, the patch applies almost cleanly, with a small change in one file, see discussion in http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-May/003185.html. Follow-ups mentioned above went perfectly clean after this fix, tests are OK.
29-05-2020

[~clanger] Approved for 11u, but please also push a backport of JDK-8239557.
16-04-2020

Backporting this to OpenJDK 11u will require this graal PR (or similar) to get merged in order to continue to be able to build with it. https://github.com/oracle/graal/pull/2337
10-04-2020

[~clanger] Shouldn't be JDK-8239557 part of the list of bugs getting backported together with this change?
09-04-2020

Fix request (11u): Requesting to backport this for parity with Oracle. RFR is out: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-April/002956.html. It has the prerequisite of JDK-8242154 and I'll also backport/commit JDK-8233137, JDK-8233291 and JDK-8234696 together with this.
05-04-2020

Consider my_image produced by jlink as follows: > export ALL_MODULES=$(java --list-modules | sed 's:@.*::g' | tr '\n' ',') > jlink --keep-packaged-modules=my_image/jmods --add-modules $ALL_MODULES --output my_image --vendor-version='XyzzyVM 3.14.15' --vendor-bug-url=https://bugs.xyzzy.com/ --add-options='-Dfoo=xyzzy' > my_image/bin/java -XshowSettings:properties --version 2>&1 | grep -i xyzzy foo = xyzzy java.vendor.url.bug = https://bugs.xyzzy.com/ java.vendor.version = XyzzyVM 3.14.15 Java(TM) SE Runtime Environment XyzzyVM 3.14.15 (build 11.0.5.0.50+1-LTS) Java HotSpot(TM) 64-Bit Server VM XyzzyVM 3.14.15 (build 11.0.5.0.50+1-LTS, mixed mode) I would expect that when producing my_image2 from my_image, the custom vendor and option overrides would be preserved without having to specify them again to jlink. However, this appears not to be the case: > my_image/bin/jlink --keep-packaged-modules=my_image2/jmods --add-modules $ALL_MODULES --output my_image2 > my_image2/bin/java -XshowSettings:properties --version 2>&1 | grep -i xyzzy > As a concrete example, for GraalVM this means anyone jlink'ing an image from GraalVM that includes jdk.internal.vm.compiler will be surprised when Graal is not used as the default JIT in the created image. Is this the intended semantics of the --vendor* and --add-options flags? If so, I think an extra option such as --preserve-customization would make sense.
02-12-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/6c255334120d User: mr Date: 2019-10-29 16:51:46 +0000
29-10-2019

Webrev: https://cr.openjdk.java.net/~mr/rev/8232080/ Review thread: https://mail.openjdk.java.net/pipermail/core-libs-dev/2019-October/063002.html
23-10-2019