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());
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)
I was under the impression that Java 7 was capable of handling large zip files. Can anyone explain why this is happening?
Thanks.