sra*_*van 19 boot sprint intellij-idea maven
java: cannot access org.springframework.boot.SpringApplication
bad class file: /C:/Users/xyz/.m2/repository/org/springframework/boot/spring-boot/3.0.0-SNAPSHOT/spring-boot-3.0.0-20220910.145857-773.jar!/org/springframework/boot/SpringApplication.class
class file has wrong version 61.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
Run Code Online (Sandbox Code Playgroud)
小智 19
将您的 springboot 版本更改为之前的稳定版本。
前:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0</version>
<relativePath/> <!-- lookup parent from repository -->
Run Code Online (Sandbox Code Playgroud)
后:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.4</version>
<relativePath/> <!-- lookup parent from repository -->
Run Code Online (Sandbox Code Playgroud)
sam*_*cde 18
类文件版本错误 61.0,应该是 52.0
参考Java类文件格式主要版本号列表?。和类似的问题Class file has error version 52.0, Should be 50.0 它表明您正在使用 java 8 但该类文件是为 java 17 编译的。
如果您的计算机上安装了 java 8,并且访问 spring 初始化程序网站并通过选择 Spring boot 3.0.0 (SNAPSHOT) 并打包为 Jar 且版本为 8 创建应用程序,则生成的 zip 文件的版本将为 11在 pom 上,即使您选择版本为 8。这意味着,您的本地计算机具有 java 版本 8,并且生成的 zip 文件在 pom 上具有版本 11。
我将版本从2.7.5更改为3.0.1,它遇到了这个问题。
\njava: cannot access org.springframework.boot.SpringApplication bad class file\nRun Code Online (Sandbox Code Playgroud)\n要解决此问题,Spring Boot 3 至少需要Java 17或更高版本的Java。
\n我也遇到了这个问题,因为我使用的是Java 11,所以当我转换为Java 17时 ,所以当我在 pom.xml 中
\n <properties>\n <java.version>17</java.version>\n </properties>\nRun Code Online (Sandbox Code Playgroud)\n以及项目和模块的项目结构以及项目完美运行
\n笔记: SNAPSHOT、M1、M2、M3 和 M4 版本通常正在进行中。Spring 团队仍在研究它们,建议不要使用它们。
\n我希望这有帮助!如果您有任何疑问或者还有什么我可以帮助您的,请告诉我。
\n快乐编码!\xe2\x80\x8d
\n| 归档时间: |
|
| 查看次数: |
53660 次 |
| 最近记录: |