“Invalid signature file” when attempting to run a .jar

后端 未结 21 2381
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 05:34

My java program is packaged in a jar file and makes use of an external jar library, bouncy castle. My code compiles fine, but running the jar leads to the following error:

21条回答
  •  面向向阳花
    2020-11-22 06:07

    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!)

    Finally, this helped me

    zip -d demoSampler.jar 'META-INF/*.SF' 'META-INF/*.RSA' 'META-INF/*SF'
    

    Guess what's been removed from my jar file?!

    deleting: META-INF/ECLIPSE_.SF 
    deleting: META-INF/ECLIPSE_.RSA
    

    It seems that the issue was relevant to some eclipse-relevant files.

提交回复
热议问题