Summary
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.
Problem
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.
Solution
Add the --generate-cds-archive
plugin option to the jlink command. If the user specifies the option, the default CDS archives will be generated.
Specification
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
The 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
- csr of
-
JDK-8264322 Generate CDS archive when creating custom JDK image
- Resolved
- relates to
-
JDK-8330019 Add jlink --generate-cds-archive plugin to generate CDS archive in the resulting image
- Closed