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

查看:155
本文介绍了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天全站免登陆