Unsupported major.minor version 52.0(unable to load class com.xxxxxxx.xxx.xx.xx)

简介: Unsupported major.minor version 52.0(unable to load class com.xxxxxxx.xxx.xx.xx)

本地编译工程,部署到远程服务器,tomcat运行报错

Unsupported major.minor version 52.0(unable to load class com.xxxxxxx.xxx.xx.xx)

错误原因:

   查阅诸多资料得出的结论就是:项目编译得到的class文件的版本高于运行环境中jre的版本号,高版本JDK编译的class不能在低版本的jvm虚拟机下运行,否则就会报这类错,因此无法运行!49,50,51,52是Java编译器内部的版本号,版本对应信息如下:

 Unsupported major.minor version 52.0 对应于 JDK1.8(JRE1.8)  

 Unsupported major.minor version 51.0 对应于 JDK1.7(JRE1.7)  

 Unsupported major.minor version 50.0 对应于 JDK1.6(JRE1.6)  

 Unsupported major.minor version 49.0 对应于 JDK1.5(JRE1.5)  

因此出现问题的原因就是:编译产生的class文件是jdk1.8版本的,而jvm环境低于1.8,因此报错

 

解决过程:

1.降低项目jdk

 

报错原因 本地编译是jdk1.8 服务器的jdk是1.7 所以冲突

把jdk改成1.7 重新编译发布,就可以了

在Properties-->JAVA Compiler-中的Compiler compliance level从1.8改成1.7,之后就可以运行了。

 

2.升级服务器jdk环境

安装jdk相应版本(如jdk1.8)

 

初次使用请参考这篇:JAVA环境变量JAVA_HOME、CLASSPATH、PATH设置详解

已有环境只需要将JDK升级即可,按以下步骤修改JAVA_HOME 相应JDK安装路径

e8c645f44047b76943a3fb211d2641b.png

目录
相关文章
Unsupported major.minor version 52.0
Unsupported major.minor version 52.0
|
7月前
|
Java
Version 1.8.0_201 of the JVM is not suitable for this product. Version: 11 or greater is required.
Version 1.8.0_201 of the JVM is not suitable for this product. Version: 11 or greater is required.
176 0
|
数据采集 缓存 Android开发
Assertion desc failed at libswscale/swscale_internal.h:674和ffmpeg的各种key+value
Assertion desc failed at libswscale/swscale_internal.h:674和ffmpeg的各种key+value
241 0
Dx unsupported class file version 52.0 Conversion to Dalvik format failed with error 1
Dx unsupported class file version 52.0 Conversion to Dalvik format failed with error 1
156 0
|
Java
The type XXX cannot be resolved. It is indirectly referenced from required .class files
The type XXX cannot be resolved. It is indirectly referenced from required .class files
143 0
|
Java
Drools7.0.0.Final Unsupported major.minor version 52.0异常
Drools7.0.0.Final Unsupported major.minor version 52.0异常
140 0
Java_异常_06_ Unsupported major.minor version 52.0
    二、参考资料 1.如何解决Unsupported major.minor version 52.0问题? 2.Unsupported major.minor version 52.0 3. Unsupported major.minor version 52.0解决办法
1166 0
|
Java 应用服务中间件 Android开发