Samuel Smith
Samuel Smith

Reputation: 340

Unable to run jetty start.jar

When I run start.jar I get the following error:

 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$000(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)
 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.

Thanks, Sam

Upvotes: 13

Views: 18420

Answers (6)

Dino Velić
Dino Velić

Reputation: 898

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.

So download proper Jetty installation, in Eclipse go to Windows -> Preferences -> Servers -> Jetty -> Edit -> browse to your newly downloaded installation directory.

Upvotes: 0

mani_nz
mani_nz

Reputation: 5642

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 !!!!

Upvotes: 0

CloudyMarble
CloudyMarble

Reputation: 37576

This could happen when you have some code compiled using higher JDK, try to check the JDKs used to compile your code.

Besides according to the documetnation Jetty 9 needs JVM 1.7.

Further links:

Upvotes: 7

looper
looper

Reputation: 1989

The newest release of Jetty needs Version 1.7 of the JVM. Update your JVM or use an older version of Jetty (not recommended).

You can see the Jetty-versions here: http://www.eclipse.org/jetty/documentation/9.0.2.v20130417/what-jetty-version.html#d0e75

Upvotes: 3

Alpesh Gediya
Alpesh Gediya

Reputation: 3794

java.lang.UnsupportedClassVersionError happens because of a higher JDK during compile time and lower JRE during runtime.

So upgred your JRE to the version of compiled time version of JDK.

Upvotes: 2

AlexR
AlexR

Reputation: 115388

Take a look on the following discussion and 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.

Upvotes: 11

Related Questions