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

Implement JEP 493: Linking Run-Time Images without JMODs

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • None
    • tools
    • b24
    • generic
    • generic

      Currently there is no way to produce smaller, application specific images from a given JDK unless the packaged modules (directory 'jmods') are present:

      $ ./jdk-22/bin/jlink --add-modules jdk.jlink,java.base --output jdk22-jlink-min
      $ ./jdk22-jlink-min/bin/jlink --add-modules java.base --output java-base-runtime
      Error: --module-path is not specified and this runtime image does not contain jmods directory.
      Usage: jlink <options> --module-path <modulepath> --add-modules <module>[,<module>...]
      Use --help for a list of possible options


      Use cases in the container world include providing a JDK in layer A and adding the application in layer B. It would be nice to support layer C: Application + only needed modules for that application *without* packaged modules present in layer A. Allowing the jlink feature on a JDK without packaged modules has size advantages as compared to the packaged modules workflow. For example for JDK 22+4 we see this on Linux:

      $ du -sh ./jdk-22/
      350M ./jdk-22/
      $ du -sh ./jdk-22/jmods
      89M ./jdk-22/jmods

      One limitation of such a feature would be that it's not possible to use this mode in a cross-link setup (i.e. jlink a runtime on platform A which targets platform B given a JDK with packaged modules is available on host A for platform B).

            sgehwolf Severin Gehwolf
            sgehwolf Severin Gehwolf
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: