Problem

I use a JDK1.6 to compile a class file, WAR it and deploy to Tomcat server (another machine), but Tomcat server JAVA_HOME or JRE_HOME environment variable is set to JDK.1.5, and causing :

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

Solution

This is always caused by the conflict of different Java JDK at compile time and runtime, make sure you are using same JDK version to compile and run it.

Any Java questions or problems? please post at this JavaNullPointer.com forum, see you there ~