java.util.zip.ZipException: invalid entry size (expected 0 but got XXX bytes) 的天坑问题!

用java Oracle jdk1.8  解压一个zip 如题的错误,一顿bing。有了结果

 

Cause

This has to do with the file format being ZIP64 which is currently not supported in any of the java.util.Zip classes.
The maximum file size made possible by the original, open source Zip file specification was 4 gigabytes. This limit applied both to the uncompressed and compressed sizes of files inside Zip files (.zip or .zipx), and also to the total size of a Zip file itself. To work around this, the ZIP64 extensions were introduced - but there has not been support for ZIP64 in the Java Zip classes.

If smaller than 4GB files run into this issue, then it is possible that the file format used by the compression client may still be using ZIP64 explicitly.

Diagnosing The Problem

Analyze the file format of the zip file being unzipped in SI/SFG. If it is ZIP64 (or larger than 4GB) then this is the limitation within the JDK.

Resolving The Problem

Customers are advised to use the Command Line Adapter 2 to run an external program that supports the ZIP64 extensions (e.g., on Windows the latest version of WinZip supports ZIP64) to decompress the files.

 
 
IBM给出的答案,jdk限制4G以上的zip解压。 果断换iBM的openJ9 JDK 然后就完美解决了。
原文连接 https://www.ibm.com/support/pages/zip-file-unreadable-cause-javautilzipzipexception-invalid-entry-size
 
然后openJDK 镜像推荐 
https://mirrors.tuna.tsinghua.edu.cn/AdoptOpenJDK/8/jdk/x64/windows/

 

 推荐使用openJ9.

 
 
posted @ 2021-12-22 23:28  天朝95  阅读(2685)  评论(0编辑  收藏  举报