I have a zip file that contains 5 files. Four of the files are small (a few kB), but one file is larger than 4GB. I'm aware of JDK-4681995, which added large file support (64-bit zip support) to Java starting in Java 7. I'm using 64 bit Java 8 on Windows 8.1:
C:\Users\user\Desktop>java -version
java version "1.8.0_212"
Java(TM) SE Runtime Environment (build 1.8.0_212-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)
The zip file size is as follows:
07/07/2019 10:18 AM 503,966,751 snapshot-20190707.zip
The contents of the zip file are:
07/07/2019 09:53 AM 67 database.sha1
07/07/2019 09:51 AM 4,508,840,068 database.sql
07/07/2019 09:53 AM 74 database_schema.sha1
07/07/2019 09:51 AM 36,386 database_schema.sql
07/07/2019 09:51 AM 45,280 backup.log
If I try to extract the 4GB file, I encounter an exception that looks exactly like the Java 7 exception for 64-bit zip files:
C:\Users\user\Desktop>jar xvf snapshot-20190707.zip database.sql
java.util.zip.ZipException: invalid CEN header (bad signature)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.zip.ZipFile.<init>(ZipFile.java:126)
at sun.tools.jar.Main.extract(Main.java:1004)
at sun.tools.jar.Main.run(Main.java:305)
at sun.tools.jar.Main.main(Main.java:1288)
Is there any way to extract a 4GB+ file from a 64-bit zip archive using the Java 8+ jar
command?