Issue
I have Java 8 (JDK and JRE 8) on my machine. I have Eclipse Mars 4.5.1 . I am trying to create a simple Static Web Project and while running the project on HTTP Preview (or a Dynamic Web Project on Apache Tomcat for that matter), it gives the following error. (Also see the screenshot attached.)
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/eclipse/jetty/server/Handler : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Solution
The problem is that you're using JDK1.8 to compile your code (with target runtime of 1.8).
However, your server is configured to run with JDK 1.6 (you can see it at the top of the console window [ HTTP preview at...])
Change your workspace default JRE to your JDK 1.8 if you want to use the http preview (I tried and saw no option to specify a runtime JRE).
If you want to use tomcat, then specify the correct JRE on the first page of the 'New Server' wizard.
Answered By - ernest_k
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.