JDK-8232753 : jlink plugins for vendor information and command-line options
  • Type: CSR
  • Component: tools
  • Sub-Component: jlink
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 14
  • Submitted: 2019-10-21
  • Updated: 2019-10-29
  • Resolved: 2019-10-29
Related Reports
CSR :  
Relates :  
Description
Summary
-------

Extend the `jlink` tool with options to update the vendor version string, the vendor bug URL, and the vendor VM bug URL in the resulting image, and to allow VM command-line options to be saved in the image.

Problem
-------

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.

Solution
--------

Define new `jlink` plugins to implement the desired options.

Specification
-------------

The new jlink plugins will 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
PS Filed JDK-8233160: Add java.vendor.url.bug to list of recognized standard system properties.
29-10-2019

Moving to Approved. I think a follow-up issue to add `java.vendor.url.bug` to the standard set of properties would be a fine RFE.
29-10-2019

- The `java.vendor.url.bug` property has been defined by every Sun/Oracle JDK going all the way back to JDK 5 (and possibly earlier; JDK 5 is the oldest release that I can still run on my development machine). Yet, it's never been specified. I suggest that specifying a historically-common system property is best done in a separate request (which I'm happy to submit), rather than be buried in this one. - This proposal intentionally does not define a system property for the vendor VM bug URL, since that value is only displayed in VM crash dumps. In any other context in which a bug-reporting URL is needed, `java.vendor.url.bug` should be used. - There are no restrictions on the content of the vendor version string, which is nowhere guaranteed to be parseable by `Runtime.Version`.
29-10-2019

The method java.lang.System.getProperties() lists three standard vendor-related system properties: - `java.vendor` - `java.vendor.url` - `java.vendor.version` (optional) One of these can be set by the jimage options being proposed. Should `java.vendor.url.`*`bug`* (as opposed to `java.vendor.url`) be listed an a new optional standard property? Should, say `jdk.vendor.vm.bug.url` be added to the of additional keys a JDK may define in the getProperties spec? Are there constraints on the format of vendor version that should be listed to ensure Runtime.version operates properly?
28-10-2019

The fixVersion is currently blank, 11 or 14?
22-10-2019