eclipse 无效或损坏的 jarFile

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34662600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:00:15  来源:igfitidea点击:

Invalid or corrupt jarFile

javaeclipsemavenjar

提问by Smeiff

This question has been asked various times across this forum but none of these seem to be stemming from the same issue I'm having. So here is my issue...

这个问题在这个论坛上被问过多次,但这些似乎都不是源于我遇到的同一个问题。所以这是我的问题...

I have multiple runnable jar files I use for various projects, these are Selenium projects if that makes more sense. I've not had any issues with any of these jars in the past and I have two servers running all the jars. I am able to run the other jars just fine so can't figure out what the issue is. Only thing that is new is I added some new dependencies in this specific project. On two of my machines this jar works fine. I stored the jar on the network and ran it from these two machines - works fine. Run it from the server machine and I get "Invalid of corrupt jarFile xxx.jar". Since this error is so generic I have no idea what to go on...

我有多个可运行的 jar 文件用于各种项目,如果更有意义,这些是 Selenium 项目。过去我对这些 jar 中的任何一个都没有遇到任何问题,而且我有两台服务器运行所有 jar。我能够很好地运行其他罐子,所以无法弄清楚问题是什么。唯一的新东西是我在这个特定项目中添加了一些新的依赖项。在我的两台机器上,这个 jar 工作正常。我将 jar 存储在网络上并从这两台机器上运行它 - 工作正常。从服务器机器运行它,我得到“损坏的 jarFile xxx.jar 无效”。由于这个错误是如此普遍,我不知道该怎么办......

Run the jar by using "java -jar xxx.jar [params]".

使用“java -jar xxx.jar [params]”运行jar。

I did notice that the java version on my two machines is 1.8 and the server is 1.7 however the project is built on java 1.7.

我确实注意到我的两台机器上的 java 版本是 1.8,服务器是 1.7 但是该项目是建立在 java 1.7 上的。

Any idea on this?

对此有什么想法吗?

回答by Alex1620

I would use a comment for you but I don't have the reputation to comment yet so here goes:

我会为您使用评论,但我还没有评论的声誉,所以这里是:

The java version is very possibly an issue. I know that I have had some serious issues very much like what you are explaining because I was using 1.8 (while the project was a 1.6 or 1.7). So using 1.7 instead of 1.8 could definitely be an issue.

java 版本很可能是一个问题。我知道我遇到了一些很像你解释的严重问题,因为我使用的是 1.8(而该项目是 1.6 或 1.7)。所以使用 1.7 而不是 1.8 肯定是一个问题。

I know this doesn't answer your question completely but if possible I would try upgrading your server (probably not an option I know).

我知道这并不能完全回答你的问题,但如果可能的话,我会尝试升级你的服务器(我知道这可能不是一个选项)。