使用Intellij创建可执行文件.jar

时间:2014-06-05 11:15:08

标签: java jar intellij-idea

我有一个使用少量外部jar的应用,例如mail-1.4等等。现在我想用IDE(IntelliJ)执行我的应用。我也按照文件>项目结构>工件等说明进行操作,但我的命令提示符说:

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)

我的MANIFEST几乎是空的:

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

有什么问题?

1 个答案:

答案 0 :(得分:12)

您提取到目标罐的其中一个罐子已签名。解决它的最简单方法是选择"复制到输出目录并通过清单"在"从模块创建JAR"对话框