不支持的major.minor版本52.0错误 [英] Unsupported major.minor version 52.0 Error

查看:413
本文介绍了不支持的major.minor版本52.0错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JDK 1.8上编译了代码。我创建了war文件并将其部署在运行JRE 1.8的Ubuntu服务器上的Tomcat8上。
打开主页时出现此错误:

I have codes compiled on JDK 1.8. I created war file and deployed it on Tomcat8 in an Ubuntu server running JRE 1.8. I have this error when opening the main page:


java.lang.UnsupportedClassVersionError:com / dash / io / web / bind / HomeCtrl
:不支持的major.minor版本52.0

java.lang.UnsupportedClassVersionError: com/dash/io/web/bind/HomeCtrl : Unsupported major.minor version 52.0



$ 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

需要帮助。谢谢。

推荐答案

我猜你正在使用maven制作你的战争和maven-compiler-plugin。
您是否在那里设置了源版本和目标版本?
默认配置可能不是您想要的。
http:/ /maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

I'm guessing you are using maven to make your war and the maven-compiler-plugin. Have you well set your source and target version there ? The default configuration may not be what you want. http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

这篇关于不支持的major.minor版本52.0错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆