我写了一个简单的java程序,我在其中引用了下面的jar文件 commons-logging-1.2.jar commons-lang-2.6.jar commons-configuration-1.9.jar commons-collections4-4.4.jar 我已将这些文件放在 lib 文件夹路径中,并在 .profile 文件中设置 CLASSPATH 变量。 还授予所有 jar 文件的执行权限。 但在编译我的 java 文件时仍然出现以下错误。
错误:读取/app/produagg/aggregator/java/lib/commons-logging-1.2.jar 时出错;无效的 END header (错误的中央目录偏移) 错误:读取/app/produagg/aggregator/java/lib/commons-lang-2.6.jar 时出错;无效的 END header (错误的中央目录偏移) 错误:读取/app/produagg/aggregator/java/lib/commons-configuration-1.9.jar 时出错;无效的 END header (错误的中央目录偏移) 错误:读取/app/produagg/aggregator/java/lib/commons-collections4-4.4.jar 时出错;无效的 END header (错误的中央目录偏移)
为什么会出现这个错误? 该程序在开发和 SIT 以及预生产环境中运行良好。
最佳答案
很可能您的 JAR 文件已损坏。检查 commons-logging-1.2.jar
的大小。应为 61829 字节。
% wget -S -O /dev/null 'https://repo1.maven.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.jar' 2>&1 | fgrep Content-Length:
Content-Length: 61829
MD5 总和应为 040b4b4d8eac886f6b4a2a3bd2f31b00
:
% md5sum commons-logging-1.2.jar
040b4b4d8eac886f6b4a2a3bd2f31b00 commons-logging-1.2.jar
关于Java 编译错误无效的 END header (错误的中央目录偏移量),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59256599/