Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8269178

Add jlink --generate-cds-archive plugin to generate CDS archive in the resulting image

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 18
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      No behavioral change. The `--generate-cds-archive` plugin is not enabled by default.
    • Interface Kind:
      add/remove/modify command line option
    • Scope:
      JDK

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ccheung Calvin Cheung
              Reporter:
              ccheung Calvin Cheung
              Reviewed By:
              Alan Bateman, Mandy Chung
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: