Tomcat – java.lang.UnsupportedClassVersionError: Bad version number in .class file

Author - Webner
18.02.2015
|
0 Comments
|

This is because your class files were compiled with a Java compiler not compatible with JVM in use within tomcat. If you compiled on same machine on which you have tomcat running, you must be having 2 JDKs (or a JDK and another JRE) with different versions. Solution to this is:

On Linux –

a) find tomcat bin folder and open catalina.sh in it (on my machine it is /usr/share/tomcat6/bin). You can also search for catalina.sh directly (find / -namecatalina.sh).

b) Add correct JAVA_HOME to it and then restart tomcat (add it after all initial comments statements end)

export JAVA_HOME=/opt/java/jdk1.6.0_21/

On windows, you can make the same change in catalina.bat and it should work

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *