java.util.zip.ZipException:打开zip文件时出错 [英] java.util.zip.ZipException: error in opening zip file

查看:1076
本文介绍了java.util.zip.ZipException:打开zip文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Jar文件,其中包含其他嵌套的Jar.当我在此文件上调用新的JarFile()构造函数时,出现一个异常:

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:打开zip文件时出错

java.util.zip.ZipException: error in opening zip file

当我手动解压缩此Jar文件的内容并再次将其压缩时,它可以正常工作.

When I manually unzip the contents of this Jar file and zip it up again, it works fine.

我仅在WebSphere 6.1.0.7和更高版本上看到此异常.相同的东西在tomcat和WebLogic上也可以正常工作.

I only see this exception on WebSphere 6.1.0.7 and higher versions. The same thing works fine on tomcat and WebLogic.

当我使用JarInputStream代替JarFile时,我能够无任何例外地读取Jar文件的内容.

When I use JarInputStream instead of JarFile, I am able to read the contents of the Jar file without any exceptions.

推荐答案

确保您的jar文件未损坏.如果它已损坏或无法解压缩,则会发生此错误.

Make sure your jar file is not corrupted. If it's corrupted or not able to unzip, this error will occur.

这篇关于java.util.zip.ZipException:打开zip文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆