Of course happened after messing up with versions(wish for java 7), kinder-garden ended by not being able to run project on tomcat directly.
Whenever I am deploying .war(start.bat) web application on tomcat 7 by putting war under webapps folder I get exception(I don’t need explanation of what the exception is – I know, but rather how to fix it):
Caused by: java.lang.UnsupportedClassVersionError: : Unsupported major.minor version 51.0 (some classes)
Steps taken:
-
I took a look at most of the resources available either on web or here.
-
JAVA_HOME environmental set to:
C:\Program Files\Java\jdk1.6.0_30 -
PATH environmental set to:
C:\Program Files\Java\jdk1.6.0_30 -
Tomcat shows java version when doing the run:
Using CATALINA_BASE: “C:\Program Files\Apache Software Foundation\apache-tomcat-7.0.23”
Using CATALINA_HOME: “C:\Program Files\Apache Software Foundation\apache-tomcat-7.0.23”
Using CATALINA_TMPDIR: “C:\Program Files\Apache Software Foundation\apache-tomcat-7.0.23\temp”
Using JRE_HOME: “C:\Program Files\Java\jdk1.6.0_30”
Using CLASSPATH: “C:\Program Files\Apache Software Foundation\apache-tomcat-7.0.23\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\apache-tomcat-7.0.23\bin\tomcat-juli.jar”
-
In Eclipse ANT C:\Program Files\Java\jdk1.6.0_30\lib\tools.jar
-
In build path jdk1.6.0_30
Else, whenever I use tomcat server from Eclipse everything works fine…
Guys please help, I count on you I’ve literally done research on that, still nothing.
The classes mentioned in the exception were compiled on a Java 7 JDK (that’s what version 51.0 means), and therefore can’t run on a Java 6 JRE. Recompile those classes with Java 6 or, if it’s a library, get a JAR that was compiled with Java 6.