(class file version 53.0), Java Runtime versions up to 52.0错误的解决方法


遇到这个错误是在Apache Tomcat上部署应用程序的时候遇到的,具体的错误描述是:

java.lang.UnsupportedClassVersionError: HelloWorld has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) ...... ...... at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

主要的内容是:

has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method)

也就是当前的jre不能对程序进行编译,这个问题其实很简单,

Tomcat的版本和JDK的版本不对应导致的,当前我运行的jdk是1.8而我用的Tomcat版本是Tomcat 9所以就会出现这个问题。

解决方法:要么降低Tomcat的版本号,要不用JDK9,

当然我用的是前者,毕竟JDK9刚刚出来,出错还是有可能的

ok,解决了。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM