Fix Version/s: 18
Compatibility Risk Description:No behavioral change. The `--generate-cds-archive` plugin is not enabled by default.
Interface Kind:add/remove/modify command line option
Add a new jlink plugin option
--generate-cds-archive for generating CDS archives as a post processing step during the creation of a custom JDK image.
When a custom JDK image is being created using jlink, the default CDS archives (classes.jsa and classes_nocoops.jsa) are not being created. The user will need to manually create the CDS archives via the ''java -Xshare:dump'' command. To enhance the usability of jlink, this CSR proposes adding a jlink plugin option for creating the CDS archives.
--generate-cds-archive plugin option to the jlink command. If the user specifies the option, the default CDS archives will be generated.
The plugin will generate CDS archive if the following conditions are met:
- the target image platform is the same as the runtime platform of jlink
- the VM supports CDS
- the classlist exists in the target image
jlink --list-plugins output for the proposed
--generate-cds-archive would look like the following:
--generate-cds-archive Generate CDS archives (classes.jsa, classes_nocoops.jsa).
The plugin checks if the runtime platform is the same as the target image platform. If the platforms are different, an error such as the following will be displayed:
Error: Cannot generate CDS archives: target image platform linux-x64 is different from runtime platform windows-x64
In case the classlist file is not found in the target image, an error will result:
Error: Cannot generate CDS archives: classlist not found: <path to classlist>
On successful generation of the CDS archives, the following messages will be displayed:
Created CDS archive successfully Created NOCOOPS CDS archive successfully