javac: "cannot access unnamed package" message when use jar file where entres with '/' in front of classname

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: P4
    • 10
    • Affects Version/s: 9
    • Component/s: tools
    • None
    • 9

      When compiling code against a jar files contains classes in unnamed package, the following error message is produced:

      $ javac -cp getuid.jar Test.java
      Test.java:1: error: cannot access unnamed package
      public class Test {
      ^
        /getuid.class
      1 error

      The cause is that the jar file has /getuid.class entry instead of getuid.class. However, the same jar file works for JDK 8.

      javap also reports class not found with the problematic jar, where javap in JDK 8 works.

        1. Test.java
          0.0 kB
          Henry Jen

            Assignee:
            Unassigned
            Reporter:
            Henry Jen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: