我的java程序被打包在一个jar文件中,并使用了一个外部jar库,bouncy castle。我的代码编译良好,但运行jar会导致以下错误:
java.lang.SecurityException: Manifest主属性的签名文件摘要无效
我在谷歌上搜索了一个多小时,想要找到一个解释,但几乎没有什么价值。如果有人看到这个错误之前,可以提供一些帮助,我将不胜感激。
我的java程序被打包在一个jar文件中,并使用了一个外部jar库,bouncy castle。我的代码编译良好,但运行jar会导致以下错误:
java.lang.SecurityException: Manifest主属性的签名文件摘要无效
我在谷歌上搜索了一个多小时,想要找到一个解释,但几乎没有什么价值。如果有人看到这个错误之前,可以提供一些帮助,我将不胜感激。
当前回答
I've recently started using IntelliJ on my projects. However, some of my colleagues still use Eclipse on the same projects. Today, I've got the very same error after executing the jar-file created by my IntelliJ. While all the solutions in here talking about almost the same thing, none of them worked for me easily (possibly because I don't use ANT, maven build gave me other errors which referred me to http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException, and also I couldn't figure out what are the signed jars by myself!)
最后,这帮助了我
zip -d demoSampler.jar 'META-INF/*.SF' 'META-INF/*.RSA' 'META-INF/*SF'
猜猜我的jar文件里删除了什么!
deleting: META-INF/ECLIPSE_.SF
deleting: META-INF/ECLIPSE_.RSA
这个问题似乎与一些与eclipse相关的文件有关。
其他回答
我也遇到过类似的问题。原因是我使用的JDK的JRE与Windows系统中的默认JRE不同。
使用正确的java.exe解决了我的问题。
比较新jar和旧jar中的META-INF文件夹(在添加新库之前)。有可能会有新的文件。如果是,可以删除。这应该会有所帮助。 问候, 999米甲
如果您在尝试为Xamarin绑定JAR文件时遇到这种情况。Android绑定项目如下:
J2XA006:在反映清单主属性的com.your.class:无效签名文件摘要时引发了缺少类错误
只需使用Winzip打开JAR文件并删除meta-inf目录。重建-工作完成
我在使用IntelliJ IDEA 14.01时遇到了这个问题。
我可以通过以下方法修复它:
文件->项目结构->添加新的(工件)->jar->从模块与依赖创建jar从模块窗口:
选择你的主要类
来自库的JAR文件 选择复制到输出目录和链接通过清单
I've recently started using IntelliJ on my projects. However, some of my colleagues still use Eclipse on the same projects. Today, I've got the very same error after executing the jar-file created by my IntelliJ. While all the solutions in here talking about almost the same thing, none of them worked for me easily (possibly because I don't use ANT, maven build gave me other errors which referred me to http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException, and also I couldn't figure out what are the signed jars by myself!)
最后,这帮助了我
zip -d demoSampler.jar 'META-INF/*.SF' 'META-INF/*.RSA' 'META-INF/*SF'
猜猜我的jar文件里删除了什么!
deleting: META-INF/ECLIPSE_.SF
deleting: META-INF/ECLIPSE_.RSA
这个问题似乎与一些与eclipse相关的文件有关。