问题描述
我有一个在命令行中运行的项目,当我在IntelliJ中运行它时工作正常。但是,当我构建.jar并从命令行运行它时,我收到以下错误:
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)
我正在尝试使用命令java -jar JarName运行jar .jar
I'm trying to run the jar using the command java -jar JarName.jar
干杯。
推荐答案
你能跑吗 - >编辑Configuratios并检查是否有任何VM选项,程序参数或Env变量?如果使用命令行运行它们,则可能需要传递这些参数。
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
这篇关于使用IntelliJ构建.jar时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!