4

I have a project that runs in the command line which works fine when I run it within IntelliJ. However when I build the .jar and run it from the command line I get the following error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
        at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
        at sun.security.util.SignatureFileVerifier.process(Unknown Source)
        at java.util.jar.JarVerifier.processEntry(Unknown Source)
        at java.util.jar.JarVerifier.update(Unknown Source)
        at java.util.jar.JarFile.initializeVerifier(Unknown Source)
        at java.util.jar.JarFile.getInputStream(Unknown Source)
        at sun.misc.URLClassPath$JarLoader$2.getInputStream(Unknown Source)
        at sun.misc.Resource.cachedInputStream(Unknown Source)
        at sun.misc.Resource.getByteBuffer(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

I'm trying to run the jar using the command java -jar JarName.jar

Cheers.

Cypher236
  • 527
  • 1
  • 4
  • 13
  • This is due to the signed dependencies. When you build JAR file, the signed dependencies are extracted, which causes this issue. Please check this answer: http://stackoverflow.com/questions/41746177/how-do-i-create-a-runnable-jar-in-intellij-as-i-would-in-eclipse/43855741#43855741 –  May 16 '17 at 09:52

1 Answers1

3

Can you Run --> Edit Configuratios and check if there are any VM options, Program arguments or Env variables ? You might need to pass these parameters if you run it using the command line.

I found another post that might help “Invalid signature file” when attempting to run a .jar

Community
  • 1
  • 1
Arar
  • 1,926
  • 5
  • 29
  • 47
  • Thanks for the reply, I had a look and nope there doesn't seem to be any of those. I'll have a look at the link you posted as well and see if that fixes it – Cypher236 Apr 28 '16 at 17:56
  • I managed to fix it reading through the replies on the thread you linked! Thanks a lot mate – Cypher236 Apr 28 '16 at 18:12