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

javac errors after JDK-8251329 are not helpful enough to find root cause

XMLWordPrintable

    • b09
    • 18
    • b23

        After JDK-8251329, we see javac errors with messages like this:
         

        Hello.java:1: error: cannot access unnamed package
        import java.util.Date;
        ^
        ZIP file can't be opened as a file system because an entry has a '.' or '..' element in its name
        1 error

         
        The error is caused by some now invalid jar file (due to . or .. in entry names) which does not necessarily have to do with the compilation unit on which the error is thrown. The error message does not give a clue which jar file is causing the problem. This can be improved to something like:


        Hello.java:1: error: cannot access unnamed package
        import java.util.Date;
        ^
        ZipException opening "invalid.jar": ZIP file can't be opened as a file system because an entry has a '.' or '..' element in its name
        1 error

        To recreate, I have attached a little Java program "GenerateInvalidJar" that generates an invalid jar named invalid.jar which is attached as binary, too. Then, you can call javac -cp invalid.jar Hello.java to provoke the error.

          1. invalid.jar
            0.1 kB
          2. Hello.java
            0.1 kB
          3. GenerateInvalidJar.java
            0.9 kB

              clanger Christoph Langer
              clanger Christoph Langer
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: