SpringBoot启动异常Exception in thread “main“ java.lang.UnsupportedClassVersionError

 更新时间:2023年07月25日 10:00:55   作者:棒棒糖的糖不含糖  
本文主要介绍了SpringBoot启动异常Exception in thread “main“ java.lang.UnsupportedClassVersionError,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

异常提示:Exception in thread "main" java.lang.UnsupportedClassVersionError: org/springframework/boot/SpringApplication has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

 一、完整错误报文(两种)

1.1 启动异常之UnsupportedClassVersionError

Exception in thread "main" java.lang.UnsupportedClassVersionError: 
org/springframework/boot/SpringApplication has been compiled by a 
more recent version of the Java Runtime (class file version 61.0), 
this version of the Java Runtime only recognizes class file 
versions up to 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.handlefile.Application.main(Application.java:10)

1.2 启动异常之启动类无法访问

Error:(3, 32) java: 无法访问org.springframework.boot.SpringApplication
  错误的类文件: /E:/ideaMaven/repMaven/org/springframework/boot/spring-boot/
3.0.1/spring-boot-3.0.1.jar!/org/springframework/boot/SpringApplication.class
    类文件具有错误的版本 61.0, 应为 52.0
    请删除该文件或确保该文件位于正确的类路径子目录中。

二、错误原因 

 SpringBoot 与 JDK 版本冲突:新建项目时,idea 会默认选择更高的 SpringBoot 版本,但>3.0SpringBoot 的版本暂不支持 JDK1.8,所以会出现启动报错

一般来说高JDK版本能向下兼容低版本的springboot版本。

建议在springboot 2.5.x及其之前使用JDK8,之后的springboot版本使用JDK11即可

三、解决方案

在pom.xml文件中修改SpringBoot版本或JDK版本

四、简要介绍SpringBoot版本与JDK版本对应关系

SpringBoot版本JDK最低版本SpringBoot官网证据
1.0.0.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.0.1.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.0.2.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.0.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.1.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.2.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.3.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.4.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.5.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.6.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.7.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.8.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.9.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.10.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.11.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.1.12.RELEASE1.6Regardless, you will need Java SDK v1.6 or higher.
1.2.0.RELEASE1.6Spring Boot 1.2.0.RELEASE requires Java 6 and Spring Framework 4.1.3 or above.
1.2.1.RELEASE1.6Spring Boot 1.2.1.RELEASE requires Java 6 and Spring Framework 4.1.3 or above.
1.2.2.RELEASE1.7Spring Boot 1.2.2.RELEASE requires Java 7 and Spring Framework 4.1.3 or above.
1.2.3.RELEASE1.7Spring Boot 1.2.3.RELEASE requires Java 7 and Spring Framework 4.1.5 or above.
1.2.4.RELEASE1.7Spring Boot 1.2.4.RELEASE requires Java 7 and Spring Framework 4.1.5 or above.
1.2.5.RELEASE1.7Spring Boot 1.2.5.RELEASE requires Java 7 and Spring Framework 4.1.5 or above.
1.2.6.RELEASE1.7Spring Boot 1.2.6.RELEASE requires Java 7 and Spring Framework 4.1.5 or above.
1.2.7.RELEASE1.7Spring Boot 1.2.7.RELEASE requires Java 7 and Spring Framework 4.1.5 or above.
1.2.8.RELEASE1.7Spring Boot 1.2.8.RELEASE requires Java 7 and Spring Framework 4.1.5 or above.
1.3.0.RELEASE1.7Spring Boot 1.3.0.RELEASE requires Java 7 and Spring Framework 4.1.5 or above.
1.3.1.RELEASE1.7Spring Boot 1.3.0.RELEASE requires Java 7 and Spring Framework 4.1.5 or above.
1.3.2.RELEASE1.7

Spring Boot 1.3.0.RELEASE requires Java 7 and Spring Framework 4.1.5 or above.

1.3.3.RELEASE1.7Spring Boot 1.3.0.RELEASE requires Java 7 and Spring Framework 4.1.5 or above.

1.3.4.RELEASE

1.7

Spring Boot 1.3.4.RELEASE requires Java 7 and Spring Framework 4.2.6.RELEASE or above.

1.3.5.RELEASE1.7Spring Boot 1.3.5.RELEASE requires Java 7 and Spring Framework 4.2.6.RELEASE or above.
1.3.6.RELEASE1.7Spring Boot 1.3.6.RELEASE requires Java 7 and Spring Framework 4.2.7.RELEASE or above.
1.3.7.RELEASE1.7Spring Boot 1.3.7.RELEASE requires Java 7 and Spring Framework 4.2.7.RELEASE or above.
1.3.8.RELEASE1.7Spring Boot 1.3.8.RELEASE requires Java 7 and Spring Framework 4.2.8.RELEASE or above.
1.4.0.RELEASE1.7Spring Boot 1.4.0.RELEASE requires Java 7 and Spring Framework 4.3.2.RELEASE or above.
1.4.1.RELEASE1.7Spring Boot 1.4.1.RELEASE requires Java 7 and Spring Framework 4.3.3.RELEASE or above.
1.4.2.RELEASE1.7Spring Boot 1.4.2.RELEASE requires Java 7 and Spring Framework 4.3.4.RELEASE or above.
1.4.3.RELEASE1.7Spring Boot 1.4.3.RELEASE requires Java 7 and Spring Framework 4.3.5.RELEASE or above.
1.4.4.RELEASE1.7Spring Boot 1.4.4.RELEASE requires Java 7 and Spring Framework 4.3.6.RELEASE or above.
1.4.5.RELEASE1.7Spring Boot 1.4.5.RELEASE requires Java 7 and Spring Framework 4.3.7.RELEASE or above.
1.4.6.RELEASE1.7Spring Boot 1.4.6.RELEASE requires Java 7 and Spring Framework 4.3.8.RELEASE or above.
1.4.7.RELEASE1.7Spring Boot 1.4.7.RELEASE requires Java 7 and Spring Framework 4.3.9.RELEASE or above.
1.5.0.RELEASE1.7Spring Boot 1.5.0.RELEASE requires Java 7 and Spring Framework 4.3.6.RELEASE or above.
1.5.1.RELEASE1.7Spring Boot 1.5.1.RELEASE requires Java 7 and Spring Framework 4.3.6.RELEASE or above.
1.5.2.RELEASE1.7Spring Boot 1.5.2.RELEASE requires Java 7 and Spring Framework 4.3.7.RELEASE or above.
1.5.3.RELEASE1.7Spring Boot 1.5.3.RELEASE requires Java 7 and Spring Framework 4.3.8.RELEASE or above.
1.5.4.RELEASE1.7Spring Boot 1.5.4.RELEASE requires Java 7 and Spring Framework 4.3.9.RELEASE or above.
1.5.5.RELEASE1.7Spring Boot 1.5.5.RELEASE requires Java 7 and Spring Framework 4.3.10.RELEASE or above.
1.5.6.RELEASE1.7Spring Boot 1.5.6.RELEASE requires Java 7 and Spring Framework 4.3.10.RELEASE or above.
1.5.7.RELEASE1.7Spring Boot 1.5.7.RELEASE requires Java 7 and Spring Framework 4.3.11.RELEASE or above.
1.5.8.RELEASE1.7Spring Boot 1.5.8.RELEASE requires Java 7 and Spring Framework 4.3.12.RELEASE or above.
1.5.9.RELEASE1.7Spring Boot 1.5.9.RELEASE requires Java 7 and Spring Framework 4.3.13.RELEASE or above.
1.5.10.RELEASE1.7Spring Boot 1.5.10.RELEASE requires Java 7 and Spring Framework 4.3.14.RELEASE or above.
1.5.11.RELEASE1.7Spring Boot 1.5.11.RELEASE requires Java 7 and Spring Framework 4.3.15.RELEASE or above.
1.5.12.RELEASE1.7Spring Boot 1.5.12.RELEASE requires Java 7 and Spring Framework 4.3.16.RELEASE or above.
1.5.13.RELEASE1.7Spring Boot 1.5.13.RELEASE requires Java 7 and Spring Framework 4.3.17.RELEASE or above.
1.5.14.RELEASE1.7Spring Boot 1.5.14.RELEASE requires Java 7 and Spring Framework 4.3.18.RELEASE or above.
1.5.15.RELEASE1.7Spring Boot 1.5.15.RELEASE requires Java 7 and Spring Framework 4.3.18.RELEASE or above.
1.5.16.RELEASE1.7Spring Boot 1.5.16.RELEASE requires Java 7 and Spring Framework 4.3.19.RELEASE or above.
1.5.17.RELEASE1.7Spring Boot 1.5.17.RELEASE requires Java 7 and Spring Framework 4.3.20.RELEASE or above.
1.5.18.RELEASE1.7Spring Boot 1.5.18.RELEASE requires Java 7 and Spring Framework 4.3.21.RELEASE or above.
1.5.19.RELEASE1.7Spring Boot 1.5.19.RELEASE requires Java 7 and Spring Framework 4.3.22.RELEASE or above.
1.5.20.RELEASE1.7Spring Boot 1.5.20.RELEASE requires Java 7 and Spring Framework 4.3.23.RELEASE or above.
1.5.21.RELEASE1.7Spring Boot 1.5.21.RELEASE requires Java 7 and Spring Framework 4.3.24.RELEASE or above.
2.0.0.RELEASE1.8Spring Boot 2.0.0.RELEASE requires Java 8 or 9 and Spring Framework 5.0.4.RELEASE or above.
2.0.1.RELEASE1.8Spring Boot 2.0.1.RELEASE requires Java 8 or 9 and Spring Framework 5.0.5.RELEASE or above.
2.0.2.RELEASE1.8Spring Boot 2.0.2.RELEASE requires Java 8 or 9 and Spring Framework 5.0.6.RELEASE or above.
2.0.3.RELEASE1.8Spring Boot 2.0.3.RELEASE requires Java 8 or 9 and Spring Framework 5.0.7.RELEASE or above.
2.0.4.RELEASE1.8Spring Boot 2.0.4.RELEASE requires Java 8 or 9 and Spring Framework 5.0.8.RELEASE or above.
2.0.5.RELEASE1.8Spring Boot 2.0.5.RELEASE requires Java 8 or 9 and Spring Framework 5.0.9.RELEASE or above.
2.0.6.RELEASE1.8Spring Boot 2.0.6.RELEASE requires Java 8 or 9 and Spring Framework 5.0.10.RELEASE or above.
2.0.7.RELEASE1.8Spring Boot 2.0.7.RELEASE requires Java 8 or 9 and Spring Framework 5.0.11.RELEASE or above.
2.0.8.RELEASE1.8Spring Boot 2.0.8.RELEASE requires Java 8 or 9 and Spring Framework 5.0.12.RELEASE or above.
2.0.9.RELEASE1.8Spring Boot 2.0.9.RELEASE requires Java 8 or 9 and Spring Framework 5.0.13.RELEASE or above.
2.1.0.RELEASE1.8Spring Boot 2.1.0.RELEASE requires Java 8 or 9 and Spring Framework 5.1.2.RELEASE or above.
2.1.1.RELEASE1.8Spring Boot 2.1.1.RELEASE requires Java 8 and is compatible up to Java 11 (included). Spring Framework 5.1.3.RELEASE or above is also required.
2.1.2.RELEASE1.8Spring Boot 2.1.2.RELEASE requires Java 8 and is compatible up to Java 11 (included). Spring Framework 5.1.4.RELEASE or above is also required.
2.1.3.RELEASE1.8Spring Boot 2.1.3.RELEASE requires Java 8 and is compatible up to Java 11 (included). Spring Framework 5.1.5.RELEASE or above is also required.
2.1.4.RELEASE1.8Spring Boot 2.1.4.RELEASE requires Java 8 and is compatible up to Java 11 (included). Spring Framework 5.1.6.RELEASE or above is also required.
2.1.5.RELEASE1.8Spring Boot 2.1.5.RELEASE requires Java 8 and is compatible up to Java 11 (included). Spring Framework 5.1.7.RELEASE or above is also required.
2.1.6.RELEASE1.8Spring Boot 2.1.6.RELEASE requires Java 8 and is compatible up to Java 11 (included). Spring Framework 5.1.8.RELEASE or above is also required.
未完,待续...

 到此这篇关于SpringBoot启动异常Exception in thread “main“ java.lang.UnsupportedClassVersionError的文章就介绍到这了,更多相关SpringBoot启动异常内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • Idea进行pull的时候Your local changes would be overwritten by merge.

    Idea进行pull的时候Your local changes would be

    这篇文章主要介绍了Idea进行pull的时候Your local changes would be overwritten by merge.具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
    2023-11-11
  • Spring Boot 配置大全(小结)

    Spring Boot 配置大全(小结)

    本篇文章主要介绍了Spring Boot 配置大全(小结),小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
    2017-11-11
  • mybatis打印SQL,并显示参数的实例

    mybatis打印SQL,并显示参数的实例

    这篇文章主要介绍了mybatis打印SQL,并显示参数的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2020-12-12
  • 在SpringBoot中配置Thymeleaf的模板路径方式

    在SpringBoot中配置Thymeleaf的模板路径方式

    这篇文章主要介绍了在SpringBoot中配置Thymeleaf的模板路径方式,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2022-08-08
  • Java MyBatis-Plus之初始MyBatis

    Java MyBatis-Plus之初始MyBatis

    MyBatis-Plus是一个MyBatis的增强工具,在MyBatis的基础上只做增强不做修改,为简化开发、提高效率而生,本文给大家介绍MyBatis-Plus简介和快速入门教程,需要的朋友参考下吧
    2021-10-10
  • java中abstract修改类的实例方法

    java中abstract修改类的实例方法

    在本篇文章里小编给各位分享了一篇关于java中abstract修改类的实例方法,有需要的朋友们可以学习下。
    2020-12-12
  • Java多线程连续打印abc实现方法详解

    Java多线程连续打印abc实现方法详解

    这篇文章主要介绍了Java多线程连续打印abc实现方法详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2020-03-03
  • mybatis通过中间表实现一对多查询功能

    mybatis通过中间表实现一对多查询功能

    这篇文章主要介绍了mybatis通过中间表实现一对多查询,通过一个学生的id查询出该学生所学的所有科目,本文通过实例代码给大家介绍的非常详细,需要的朋友可以参考下
    2021-08-08
  • mybatis Plus 多表联合查询的实现示例

    mybatis Plus 多表联合查询的实现示例

    这篇文章主要介绍了mybatis Plus 多表联合查询的实现示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2020-09-09
  • 浅谈java什么时候需要用序列化 

    浅谈java什么时候需要用序列化 

    本文主要介绍了浅谈java什么时候需要用序列化,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2023-01-01

最新评论