java.util.zip.ZipError:CEN标头无效(签名错误) [英] java.util.zip.ZipError: invalid CEN header (bad signature)

查看:2294
本文介绍了java.util.zip.ZipError:CEN标头无效(签名错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Red Hat Linux上使用Java 1.7.0_40,我有以下代码:

I'm using Java 1.7.0_40 on Red Hat Linux and I have the following code:

Path zipfile = Paths.get(filename);
FileSystem fs = FileSystems.newFileSystem(zipfile, FileTest.class.getClassLoader());

文件名变量指向一个zip文件那是788MB。 zip文件的未压缩大小为8.3GB。当我运行上面的代码时,我得到以下异常:

The filename variable points to a zip file that is 788MB. The uncompressed size of the zip file is 8.3GB. When I run the code above I get the following exception:

Exception in thread "main" java.util.zip.ZipError: invalid CEN header (bad signature)
        at com.sun.nio.zipfs.ZipFileSystem.zerror(ZipFileSystem.java:1605)
        at com.sun.nio.zipfs.ZipFileSystem.initCEN(ZipFileSystem.java:1058)
        at com.sun.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:130)
        at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:139)
        at java.nio.file.FileSystems.newFileSystem(FileSystems.java:386)
        at FileTest.readFromZip(FileTest.java:35)
        at FileTest.main(FileTest.java:25)

我的印象是Java 7能够处理大型zip文件。任何人都可以解释为什么会发生这种情况吗?

I was under the impression that Java 7 was capable of handling large zip files. Can anyone explain why this is happening?

谢谢。

推荐答案

我也在基于Maven的项目中遇到了这个问题。出现问题的原因是罐子腐烂了。从.m2文件夹中删除了jar并重新构建了项目;它就像魅力一样。

I too faced the issue in Maven based project. The issue occurred because of corrupted jars. Deleted the jars from .m2 folder and built the project again; and it worked like charm.

这篇关于java.util.zip.ZipError:CEN标头无效(签名错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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