java 无法运行 jetty start.jar
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16685711/
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
Unable to run jetty start.jar
提问by Samuel Smith
When I run start.jar I get the following error:
当我运行 start.jar 时,出现以下错误:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/eclipse/
jetty/start/Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access##代码##0(Unknown Source)
at java.net.URLClassLoader.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)
Could not find the main class: org.eclipse.jetty.start.Main. Program will exit.
According to the Jetty documentation (http://www.eclipse.org/jetty/documentation/current/quickstart-running-jetty.html), all I need to do is download the zip, extract, and run start.jar. Google doesn't seem to provide me with any people having similar issues.
根据 Jetty 文档 ( http://www.eclipse.org/jetty/documentation/current/quickstart-running-jetty.html),我需要做的就是下载 zip、解压缩并运行 start.jar。谷歌似乎没有向我提供任何有类似问题的人。
Thanks, Sam
谢谢,山姆
采纳答案by AlexR
Take a look on the following discussionand specifically on the most popular answer.
看看下面的讨论,特别是最流行的答案。
Shortly you have a problem of class version incompatibility. Your jetty is compiled with compiler of java 7 while you are trying to run it with JVM of previous version. The solution is: go forward to Java 7: upgrade your JDK and configure eclipse to use java 7 and start enjoying the new features.
很快您就会遇到类版本不兼容的问题。当您尝试使用以前版本的 JVM 运行它时,您的码头是使用 java 7 的编译器编译的。解决方案是:继续使用 Java 7:升级您的 JDK 并配置 eclipse 以使用 Java 7 并开始享受新功能。
回答by CloudyMarble
This could happen when you have some code compiled using higher JDK, try to check the JDKs used to compile your code.
当您使用更高版本的 JDK 编译某些代码时,可能会发生这种情况,请尝试检查用于编译代码的 JDK。
Besides according to the documetnation Jetty 9 needs JVM 1.7.
此外根据文档 Jetty 9 需要 JVM 1.7。
Further links:
更多链接:
回答by looper
The newest release of Jetty needs Version 1.7 of the JVM. Update your JVM or use an older version of Jetty (not recommended).
Jetty 的最新版本需要 JVM 1.7 版。更新您的 JVM 或使用旧版本的 Jetty(不推荐)。
You can see the Jetty-versions here: http://www.eclipse.org/jetty/documentation/9.0.2.v20130417/what-jetty-version.html#d0e75
您可以在此处查看 Jetty 版本:http: //www.eclipse.org/jetty/documentation/9.0.2.v20130417/what-jetty-version.html#d0e75
回答by Alpesh Gediya
java.lang.UnsupportedClassVersionError
happens because of a higher JDK during compile time and lower JRE during runtime.
java.lang.UnsupportedClassVersionError
发生这种情况是因为编译时 JDK 较高,运行时 JRE 较低。
So upgred your JRE to the version of compiled time version of JDK.
因此,将您的 JRE 升级到 JDK 的编译时版本。
回答by mani_nz
The Java compiler is an advanced version, and the virtual machine is not. Make it uniform either by upgrading your JVM or downgrading your compiler (JDK). I recommend the second option. Gook luck !!!!
Java 编译器是高级版本,虚拟机不是。通过升级 JVM 或降级编译器 (JDK) 使其统一。我推荐第二种选择。祝你好运!!!!
回答by Dino Veli?
This can also happend if you are configuring for example Jetty 8.1 server, but your Jetty installation directory is higher than that, for example 9.1.
如果您正在配置例如 Jetty 8.1 服务器,但您的 Jetty 安装目录高于该目录,例如 9.1,也会发生这种情况。
So download proper Jetty installation, in Eclipse go to Windows -> Preferences -> Servers -> Jetty -> Edit -> browse to your newly downloaded installation directory.
所以下载正确的 Jetty 安装,在 Eclipse 中转到 Windows -> Preferences -> Servers -> Jetty -> Edit -> 浏览到你新下载的安装目录。