Invalid jar in classpath aborts the compilation and throws an exception
Jaikiran Pai
jai.forums2013 at gmail.com
Sat Jun 18 08:44:15 UTC 2022
An user of Ant has reported an issue where their project's build fails
during compilation. The failure appears to be a result of a jar (in the
classpath) having entries that the Java's java.util.zip/jar code doesn't
allow. The issue reported in Ant is here
https://bz.apache.org/bugzilla/show_bug.cgi?id=66110.
In cases like these, should the javac tool just ignore such jar files
and continue with the compilation? At least for this specific issue that
jar which is failing doesn't contribute any classes/resources for the
compilation to succeed.
The specific exception that gets thrown comes from the ArchiveContainer
which then propagates and ultimately results in a compilation error
which looks like:
/foo/src/com/abc/Bz66110.java:1: error: cannot access com.abc
package com.abc;
^
ZipException opening "bz66110badJar.jar": ZIP file can't be opened as a
file system because entry "/." has a '.' or '..' element in its name
1 error
-Jaikiran
More information about the compiler-dev
mailing list