Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8146486 Modular JARs as multi-release JARs
  3. JDK-8156499

Update jlink to support creating images with modules that are packaged as multi-release JARs

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • b143

      The jlink tool will require updates to work with modular JARs that are multi-release JARs.

      Consider the following with jdk9/dev today:

      $ jar tf m1.jar
      META-INF/
      META-INF/MANIFEST.MF
      module-info.class
      META-INF/versions/
      META-INF/versions/9/
      META-INF/versions/9/module-info.class
      META-INF/versions/9/p/
      META-INF/versions/9/p/Main.class
      META-INF/versions/9/p/Type.class
      p/
      p/Main.class

      $ jlink --output myimage --addmods m1 --modulepath m1.jar:$JAVA_HOME/jmods
      Error: module-info.class not found for META-INF module

      The main issue is that jlink attempts to create the runtime image with all resources in the modular JAR, it should only read the module classes/resources that are appropriate for the target JDK version.

      Another part is that jlink doesn't know the target major version and doesn't have any ability to configure the ModuleFinder so that the module declaration for that release is used.

            sdrach Steve Drach (Inactive)
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: