I'm getting this error when doing this (relatively simple) piece of code:
ZipFile zf = new ZipFile(fn);
Enumeration<? extends ZipEntry> eze = zf.entries();
while (eze.hasMoreElements()) {
ZipEntry ze = eze.nextElement();
System.out.println(ze.getName());
}
zf.close();
Actually. Interestingly enough, I get it on java-sun-6u32 and java-1.6.0-openjdk-amd64, but java-sun-7u4 succeeds. unzip itself seems to handle it fine. I'm guessing that means that these zipfiles are perhaps created by some newer version of zip that java 7 understands, but that previous versions do not. But, any insight would be appreciated. Also, since in production I don't really have the option of using java 7, any way of making earlier versions of java understand this new version of zip (if that in fact is what the problem is, of course.)
Thanks!
7z l -slt
output provided in your comment is quite useful:
Type = zip 64-bit
gives a hint, that it's ZIP64 (version 4.5 of ZIP specification). However, though Java7 supports it, this support is not backported to Java6 at the moment and you will have to resort to external library such as Apache Compress.
P.S. For reference, file test.zip
would output something like
test.zip: Zip archive data, at least v4.5 to extract
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With