-
Notifications
You must be signed in to change notification settings - Fork 776
Description
jlink supports the following option via the AddOptionsPlugin.
--add-options <options> Prepend the specified <options> string, which may
include whitespace, before any other options when
invoking the virtual machine in the resulting image.
This creates a resource java.base/jdk/internal/vm/options in the lib/modules file, which contains options to be prepended on VM startup.
Example
jlink --output testimage --add-modules java.base --module-path jdk-21.0.9+9/jmods --add-options -Dpeter.was.here
The resulting testimage contains a lib/modules which includes java.base/jdk/internal/vm/options, and this file contains -Dpeter.was.here.
FYI jimage can be used to extract the contents of the lib/modules file, for diagnostic purposes.
There is a test to confirm this behavior is working, which fails atm.
https://github.com/ibmruntimes/openj9-openjdk-jdk21/blob/openj9/test/jdk/tools/jlink/plugins/AddOptionsPluginTest.java
Reference https://github.ibm.com/runtimes/openj9-openjdk-jdk25-zos/issues/133