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

后端 未结 21 2257
爱一瞬间的悲伤
爱一瞬间的悲伤 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:11

    Some of your dependencies are likely signed jarfiles. When you combine them all into one big jarfile, the corresponding signature files are still present, and no longer match the "big combined" jarfile, so the runtime halts thinking the jar file has been tampered with (which it...has so to speak).

    Assuming you're using ant, you can solve the problem by eliminating the signature files from your jarfile dependencies. Unfortunately, it's not possible to do this in one step in ant.

    However, I was able to get this working with Ant in two steps, without specifically naming each jarfile dependency, by using:

    
        
            
                
            
        
        
        
            
            
                
            
        
    
    

    The sleep element is supposed to prevent errors about files with modification dates in the future.

    Other variations I found in the linked threads didn't work for me.

提交回复
热议问题