同一个java工程在tomcat7.068报错而在tomcat7.023不报错

在tomcat 7.068中报错
严重: Exception starting filter struts2
java.lang.UnsupportedClassVersionError: com/action/RegisterAction : Unsupported major.minor version 52.0 (unable to load class com.action.RegisterAction)
而在tomcat 7.023中就没有任何错误

工程都是jdk1.7 两个tomcat都是用同同一版本的jdk1.7

http://www.cnblogs.com/xing901022/p/4172410.html

运行tomcat的jdk板本比编译代码的jdk版本低。

解决办法:设置JAVA_HOME。
原文:
(3.2) Set JRE_HOME or JAVA_HOME (required)

These variables are used to specify location of a Java Runtime
Environment or of a Java Development Kit that is used to start Tomcat.

The JRE_HOME variable is used to specify location of a JRE. The JAVA_HOME
variable is used to specify location of a JDK.

Using JAVA_HOME provides access to certain additional startup options that
are not allowed when JRE_HOME is used.

If both JRE_HOME and JAVA_HOME are specified, JRE_HOME is used.

参考: