Recently I am the facing problem with Apache Tomcat 6.0.35 on Linux Centos. I am getting the error -
java.lang.UnsupportedClassVersionError: myApp : Unsupported major.minor version 51.0 (unable to load class myApp)
When I give the command -
java -version
It Shows
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.9) (rhel-1.28.1.10.9.el5_8-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
Similarly When I give the command -
javac -version
It shows -
javac 1.6.0_22
To locate the Java I give the command -
whereis java
The output is -
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java /usr/share/man/man1/java.1.gz
And for
which java
It displays -
/usr/bin/java
Also for
which javac
Output is
/usr/bin/javac
Where myApp is java project developed in Windows and Uploaded the WAR file in Tomcats' webapp directory on Linux.
I am not getting what is happening? Please can anybody please help me to resolve the problem?
Thanks in advance.
You need a Java 7 runtime, not Java 6. See http://en.wikipedia.org/wiki/Java_class_file#General_layout for some details concerning this.
Alternatively, you need to find and/or re-compile your code to be compatible with Java 6.
The exception is because yor code is compiled using a higher version than the one you are trying to run it on. In your windows machine you might be using windows 7 to build the war. Check javac -version
in your windows machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With