Java 编译错误无效的 END header (错误的中央目录偏移量)

标签 java

我写了一个简单的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/

相关文章:

java - Spring Security BCryptPasswordEncoder 已插入但不匹配

java - 使用注释在空对象引用上设置文本

java - Log4j2 : RollingFile appender does not write logs into file

java - Proguard 和错误

java - 使用 AWS Java SDK 为现有 S3 对象设置过期 header

java - 如何从文件中读取字节,而结果 byte[] 正好一样长

java - 将公共(public) Maven 存储库用于库而不是本地的优点

java - cygwin bash : java: command not found

java - resteasy-cdi 中断部署到 Tomcat 7

java - 使用eclipse在java中执行批处理