Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zip files with Java: Is there a limit?

I'm creating a backup routine for my application with Java. However, when the zip file is over 4GB, or has more than 65,000 files (approximately), the zip file is corrupted.

I'm also testing the Apache Commons Compression for compacting to tar.gz, but it has file name limit of 100 characters. I was wanting to test this API compressing to zip, but I wonder what exactly is the problem with the java zip.

So, the real question is: I'm doing something wrong, it is limit of Java Zip implementation, or is the limit for the Zip format itself?

Thanks.

like image 888
caarlos0 Avatar asked Jul 18 '11 20:07

caarlos0


1 Answers

Quoting from Wikipedia:

The original ZIP format had a 4 GiB limit on various things (uncompressed size of a file, compressed size of a file and total size of the archive), as well as a limit of 65535 entries in a ZIP archive.

and about ZIP64:

Java's built-in java.util.zip does not support it as of September 2010, but it has been added to OpenJDK and is planned for inclusion in Java 7.

like image 174
MRAB Avatar answered Oct 12 '22 13:10

MRAB