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.

 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM