java: cannot access org.springframework.boot.SpringApplication Error class file: /C:/Users/Leo/.m2/repository/org/spri

error details

java: 无法访问org.springframework.boot.SpringApplication
  错误的类文件: /C:/Users/kk/.m2/repository/org/springframework/boot/spring-boot/3.0.4/spring-boot-3.0.4.jar!/org/springframework/boot/SpringApplication.class
    类文件具有错误的版本 61.0, 应为 52.0
    请删除该文件或确保该文件位于正确的类路径子目录中。

Error reason

The reason for this error is that when creating a springboot project, springboot does not correspond to the selected JDK version

The version supported only by springboot3.0 series JDK17(generally, the JDK version in pom.xml should also be changed to 17) The version
supported by spring2.0 series by default JDK8(commonly used)

Solution

found in the projectpom.xml

  • modify version

  • insert image description here
    After modifying java.version , click maven on the upper right to update it
    insert image description here

Guess you like

Origin blog.csdn.net/qq_22841387/article/details/130772974