我有在JDK 1.8上编译的代码。 我创建了WAR文件,并将其部署在运行JRE 1.8的Ubuntu服务器上的Tomcat8中。 打开主页时出现以下错误:
java.lang.UnsupportedClassVersionError: com/dash/io/web/bind/HomeCtrl : Unsupported major.minor version 52.0
该错误表示您的Java版本过低而无法支持该应用程序的代码。 您需要升级到 Java 8(版本号:52)或更高版本。
$ java -versionjava version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
$ javac -version
javac 1.8.0_45
$ echo $JRE_HOME
/usr/local/java/jdk1.8.0_45/jre
$ /usr/local/apache-tomcat-8.0.22/bin/catalina.sh version
Using CATALINA_BASE: /usr/local/apache-tomcat-8.0.22
Using CATALINA_HOME: /usr/local/apache-tomcat-8.0.22
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.0.22/temp
Using JRE_HOME: /usr/local/java/jdk1.8.0_45/jre
Using CLASSPATH: /usr/local/apache-tomcat-8.0.22/bin/bootstrap.jar:/usr/local/apache-tomcat-8.0.22/bin/tomcat-juli.jar
Server version: Apache Tomcat/8.0.22
Server built: Apr 29 2015 11:46:15 UTC
Server number: 8.0.22.0
OS Name: Linux
OS Version: 3.13.0-52-generic
Architecture: amd64
JVM Version: 1.8.0_45-b14
JVM Vendor: Oracle Corporation
Need help. Thanks.