9

I've got an app which is using few external jars like mail-1.4 and etc. And now I want to execute my app out of IDE (IntelliJ). Also I was following instruction File>Project Structure>Artifacts and so on, but my command prompt says:

Exception in thread "main" java.lang.SecurityException: Invalid signature file
igest 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)

My MANIFEST is almost empty:

Manifest-Version: 1.0
Main-Class: ru.tenet.smsc.SMSC

What is wrong?

Tony
  • 3,605
  • 14
  • 52
  • 84
  • 1
    When do you get this error? When you build the artifact or when you run your application? I gues the latter so in this case show your command line. And you make take a look at http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar – Leos Literak Jun 05 '14 at 11:35
  • You can create a single jar with all the dependencies without worrying for the signature exception. Do not add extracted dependencies. For more details see 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:47

1 Answers1

12

One of the jars you extracted to the target jar was signed. The easiest way to fix it is to select "copy to the output directory and link via manifest" in the "Create JAR from Modules" dialog

zootropo
  • 2,441
  • 3
  • 31
  • 48