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

Inconsistent handling of exploded modules in jlink

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 10
    • 9, 10
    • tools
    • None
    • b36

      This works:

      mkdir -p foo/foo
      echo "module foo {}" > foo/module-info.java
      echo 'package foo; public class Main { public static void main(String ... args) { System.out.println("foo!"); } }' > foo/foo/Main.java
      $JAVA_HOME/bin/javac -d foo foo/module-info.java foo/foo/Main.java
      $JAVA_HOME/bin/jlink --output image --module-path $JAVA_HOME/jmods:foo --add-modules foo --launcher foo=foo/foo.Main

      No error, and ./image/bin/foo outputs "foo!" as expected

      Doing this in a directory not named foo, however, fails:

      mkdir -p classes/foo
      echo "module foo {}" > classes/module-info.java
      echo 'package foo; public class Main { public static void main(String ... args) { System.out.println("foo!"); } }' > classes/foo/Main.java
      $JAVA_HOME/bin/javac -d classes classes/module-info.java classes/foo/Main.java
      $JAVA_HOME/bin/jlink --output other_image --module-path $JAVA_HOME/jmods:classes --add-modules foo --launcher foo=foo/foo.Main
      =>
      Error: jdk.tools.jlink.plugin.PluginException: java.io.IOException: module-info.class not found for foo module

      It seems jlink derives some notion of the module name from the directory entry of the module classes on the module-path, which appears to be a bug. Information about module names should be derived from the module-info.class of the modules added to the module-path.

            sundar Sundararajan Athijegannathan
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: