I have a Jar file, which contains other nested Jars. When I invoke the new JarFile()
constructor on this file, I get an exception which says:
java.util.zip.ZipException: error in opening zip file
When I manually unzip the contents of this Jar file and zip it up again, it works fine.
I only see this exception on WebSphere 6.1.0.7 and higher versions. The same thing works fine on tomcat and WebLogic.
When I use JarInputStream instead of JarFile, I am able to read the contents of the Jar file without any exceptions.
Make sure your jar file is not corrupted. If it's corrupted or not able to unzip, this error will occur.