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

这篇具有很好参考价值的文章主要介绍了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,所以会出现启动报错

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

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

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

三、解决方案

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

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

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

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

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

1.3.3.RELEASE 1.7 Spring 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.文章来源地址https://www.toymoban.com/news/detail-428660.html

1.3.5.RELEASE 1.7 Spring Boot 1.3.5.RELEASE requires Java 7 and Spring Framework 4.2.6.RELEASE or above.
1.3.6.RELEASE 1.7 Spring Boot 1.3.6.RELEASE requires Java 7 and Spring Framework 4.2.7.RELEASE or above.
1.3.7.RELEASE 1.7 Spring Boot 1.3.7.RELEASE requires Java 7 and Spring Framework 4.2.7.RELEASE or above.
1.3.8.RELEASE 1.7 Spring Boot 1.3.8.RELEASE requires Java 7 and Spring Framework 4.2.8.RELEASE or above.
1.4.0.RELEASE 1.7 Spring Boot 1.4.0.RELEASE requires Java 7 and Spring Framework 4.3.2.RELEASE or above.
1.4.1.RELEASE 1.7 Spring Boot 1.4.1.RELEASE requires Java 7 and Spring Framework 4.3.3.RELEASE or above.
1.4.2.RELEASE 1.7 Spring Boot 1.4.2.RELEASE requires Java 7 and Spring Framework 4.3.4.RELEASE or above.
1.4.3.RELEASE 1.7 Spring Boot 1.4.3.RELEASE requires Java 7 and Spring Framework 4.3.5.RELEASE or above.
1.4.4.RELEASE 1.7 Spring Boot 1.4.4.RELEASE requires Java 7 and Spring Framework 4.3.6.RELEASE or above.
1.4.5.RELEASE 1.7 Spring Boot 1.4.5.RELEASE requires Java 7 and Spring Framework 4.3.7.RELEASE or above.
1.4.6.RELEASE 1.7 Spring Boot 1.4.6.RELEASE requires Java 7 and Spring Framework 4.3.8.RELEASE or above.
1.4.7.RELEASE 1.7 Spring Boot 1.4.7.RELEASE requires Java 7 and Spring Framework 4.3.9.RELEASE or above.
1.5.0.RELEASE 1.7 Spring Boot 1.5.0.RELEASE requires Java 7 and Spring Framework 4.3.6.RELEASE or above.
1.5.1.RELEASE 1.7 Spring Boot 1.5.1.RELEASE requires Java 7 and Spring Framework 4.3.6.RELEASE or above.
1.5.2.RELEASE 1.7 Spring Boot 1.5.2.RELEASE requires Java 7 and Spring Framework 4.3.7.RELEASE or above.
1.5.3.RELEASE 1.7 Spring Boot 1.5.3.RELEASE requires Java 7 and Spring Framework 4.3.8.RELEASE or above.
1.5.4.RELEASE 1.7 Spring Boot 1.5.4.RELEASE requires Java 7 and Spring Framework 4.3.9.RELEASE or above.
1.5.5.RELEASE 1.7 Spring Boot 1.5.5.RELEASE requires Java 7 and Spring Framework 4.3.10.RELEASE or above.
1.5.6.RELEASE 1.7 Spring Boot 1.5.6.RELEASE requires Java 7 and Spring Framework 4.3.10.RELEASE or above.
1.5.7.RELEASE 1.7 Spring Boot 1.5.7.RELEASE requires Java 7 and Spring Framework 4.3.11.RELEASE or above.
1.5.8.RELEASE 1.7 Spring Boot 1.5.8.RELEASE requires Java 7 and Spring Framework 4.3.12.RELEASE or above.
1.5.9.RELEASE 1.7 Spring Boot 1.5.9.RELEASE requires Java 7 and Spring Framework 4.3.13.RELEASE or above.
1.5.10.RELEASE 1.7 Spring Boot 1.5.10.RELEASE requires Java 7 and Spring Framework 4.3.14.RELEASE or above.
1.5.11.RELEASE 1.7 Spring Boot 1.5.11.RELEASE requires Java 7 and Spring Framework 4.3.15.RELEASE or above.
1.5.12.RELEASE 1.7 Spring Boot 1.5.12.RELEASE requires Java 7 and Spring Framework 4.3.16.RELEASE or above.
1.5.13.RELEASE 1.7 Spring Boot 1.5.13.RELEASE requires Java 7 and Spring Framework 4.3.17.RELEASE or above.
1.5.14.RELEASE 1.7 Spring Boot 1.5.14.RELEASE requires Java 7 and Spring Framework 4.3.18.RELEASE or above.
1.5.15.RELEASE 1.7 Spring Boot 1.5.15.RELEASE requires Java 7 and Spring Framework 4.3.18.RELEASE or above.
1.5.16.RELEASE 1.7 Spring Boot 1.5.16.RELEASE requires Java 7 and Spring Framework 4.3.19.RELEASE or above.
1.5.17.RELEASE 1.7 Spring Boot 1.5.17.RELEASE requires Java 7 and Spring Framework 4.3.20.RELEASE or above.
1.5.18.RELEASE 1.7 Spring Boot 1.5.18.RELEASE requires Java 7 and Spring Framework 4.3.21.RELEASE or above.
1.5.19.RELEASE 1.7 Spring Boot 1.5.19.RELEASE requires Java 7 and Spring Framework 4.3.22.RELEASE or above.
1.5.20.RELEASE 1.7 Spring Boot 1.5.20.RELEASE requires Java 7 and Spring Framework 4.3.23.RELEASE or above.
1.5.21.RELEASE 1.7 Spring Boot 1.5.21.RELEASE requires Java 7 and Spring Framework 4.3.24.RELEASE or above.
2.0.0.RELEASE 1.8 Spring Boot 2.0.0.RELEASE requires Java 8 or 9 and Spring Framework 5.0.4.RELEASE or above.
2.0.1.RELEASE 1.8 Spring Boot 2.0.1.RELEASE requires Java 8 or 9 and Spring Framework 5.0.5.RELEASE or above.
2.0.2.RELEASE 1.8 Spring Boot 2.0.2.RELEASE requires Java 8 or 9 and Spring Framework 5.0.6.RELEASE or above.
2.0.3.RELEASE 1.8 Spring Boot 2.0.3.RELEASE requires Java 8 or 9 and Spring Framework 5.0.7.RELEASE or above.
2.0.4.RELEASE 1.8 Spring Boot 2.0.4.RELEASE requires Java 8 or 9 and Spring Framework 5.0.8.RELEASE or above.
2.0.5.RELEASE 1.8 Spring Boot 2.0.5.RELEASE requires Java 8 or 9 and Spring Framework 5.0.9.RELEASE or above.
2.0.6.RELEASE 1.8 Spring Boot 2.0.6.RELEASE requires Java 8 or 9 and Spring Framework 5.0.10.RELEASE or above.
2.0.7.RELEASE 1.8 Spring Boot 2.0.7.RELEASE requires Java 8 or 9 and Spring Framework 5.0.11.RELEASE or above.
2.0.8.RELEASE 1.8 Spring Boot 2.0.8.RELEASE requires Java 8 or 9 and Spring Framework 5.0.12.RELEASE or above.
2.0.9.RELEASE 1.8 Spring Boot 2.0.9.RELEASE requires Java 8 or 9 and Spring Framework 5.0.13.RELEASE or above.
2.1.0.RELEASE 1.8 Spring Boot 2.1.0.RELEASE requires Java 8 or 9 and Spring Framework 5.1.2.RELEASE or above.
2.1.1.RELEASE 1.8 Spring 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.RELEASE 1.8 Spring 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.RELEASE 1.8 Spring 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.RELEASE 1.8 Spring 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.RELEASE 1.8 Spring 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.RELEASE 1.8 Spring 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的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Exception in thread “main“ java.lang.reflect.InvocationTargetException

    idea中app后台本地运行成功,但是打成jar包后运行,失败报错如下 原因分析:jar包运行存在问题,项目中有dockerfile文件,直接执行java -jar会报错,因为dockerfeil文件中配置了启动jar包的命令:    

    2024年02月08日
    浏览(46)
  • 已解决Exception in thread “main“ java.lang.NullPointerException

    已解决Exception in thread “main” java.lang.NullPointerException Exception in thread “main“ java.lang.NullPointerException 对于异常 “Exception in thread “main” java.lang.NullPointerException” 的详细解决方法 下滑查看解决方法 可以按照以下步骤进行处理: 确定异常的位置:根据异常信息中提供的线程和

    2024年01月22日
    浏览(52)
  • 已解决:Exception in thread “main“ java.lang.NoSuchMethodError

    分为两种情况,如果找不到自己写的某个方法,一般是main函数没加static之类的。这里讨论第二种情况:找不到第三方包中的某个方法。 这样的情况大概率是因为这个报错的包在Maven依赖中存在多个版本,存在版本冲突。如下面的报错就是因为google.protobuf这个包有多个版本,而

    2024年02月08日
    浏览(58)
  • Exception in thread “main“ java.lang.UnsupportedClassVersionError 50报错处理

    之间正常走jenkins+docker自动化部署的项目,今天改了一个文件,点了一下,竟然没有部署上去,提示如上,如下  Exception in thread \\\"main\\\" java.lang.UnsupportedClassVersionError: com/coocaa/tsp/sys/user/UserServerApplication has been compiled by a more recent version of the Java Runtime (class file version 55.0), this ver

    2024年02月10日
    浏览(44)
  • 已解决 Java Error: Exception in thread ‘main‘ java.lang.ClassNotFoundException

    🌷🍁 博主猫头虎(🐅🐾)带您 Go to New World✨🍁 🦄 博客首页 : 🐅🐾猫头虎的博客🎐 《面试题大全专栏》 🦕 文章图文并茂🦖生动形象🐅简单易学!欢迎大家来踩踩~🌺 《IDEA开发秘籍专栏》 🐾 学会IDEA常用操作,工作效率翻倍~💐 《100天精通Golang(基础入门篇)》 🐅

    2024年02月03日
    浏览(56)
  • picard安装时报错“Exception in thread “main“ java.lang.UnsupportedClassVersionError”

    最近在通过GATK所介绍的best practice流程来call SNP流程 1.1 BWA比对,获得sam文件 1.2 准备用picard来压缩排序sam文件为bam文件,并对bam文件进行去重复(duplicates marking) 这是就需要用到picard软件 按照教程网页上给的下载路径picard download | SourceForge.net,里面是2015年的1.119版本,下载

    2024年02月13日
    浏览(62)
  • 【Unity】安卓打包失败Exception in thread “main“ java.lang.UnsupportedClassVersionError

    Exception in thread “main” java.lang.UnsupportedClassVersionError: com/android/sdklib/tool/sdkmanager/SdkManagerCli 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 Java .lang. unsupportedclassversionerror: com/android/sdklib/tool/sdkm

    2024年02月19日
    浏览(47)
  • poi报错 Exception in thread “main“ java.lang.NoSuchFieldError: Factory

    背景:要实现一个需求,按照word模板合成一定的内容,给到前端,但是却跌到在了第一步,就是这个依赖的问题上 这个问题归根到底就是这个依赖冲突问题, 可是让我奇怪的是我用那个依赖分析器解决了poi-tl文件的冲突,因为我之前还使用了ali的easyexcel好多使用这个poi-相关

    2024年02月07日
    浏览(48)
  • 运行java项目时Exception in thread “main“ java.lang.UnsupportedClassVersionError解决办法

    本地终端CMD运行java项目时,Exception in thread “main“ java.lang.UnsupportedClassVersionError,报错截图: 1、解决措施就是保证jvm(java命令)和jdk(javac命令)版本一致。如果是windows版本,则在命令行中分别输入java -version和javac -version命令来查看版本是否一致。 发现java版本为1.8.0,而

    2024年02月11日
    浏览(49)
  • Exception in thread “main“ java.lang.NoClassDefFoundError: javax/servlet/Servlet

    缺少jar包 jar包冲突 先查看pom文件中是否引入了对应的依赖,如果没有的话,需要引入: 如果是从 Maven Repository 上面获取的依赖记得要 删除scop 这一行,我就是网上找了几百种方法,才发现是这个问题!

    2024年02月13日
    浏览(49)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包