java_ Unable to access org.springframework.boot.SpringApplication error class file_ _C__Users_Yang_.m2_repository_org_spring
Table of contents
- Problem Description
- solution
Problem Description
During the learning process of Mybatis quick start, I want to test the following simple method.
The result is an error:
Error report details:
java: Inaccessibleorg.springframework.boot.SpringApplication
Wrong class file: /C:/Users/Yang/.m2/repository/org/springframework/boot/spring-boot/3.2.5/spring-boot-3.2.5.jar!/org/springframework/boot/SpringApplication.class
Class file has wrong version 61.0, Should be 52.0
Please delete the file or ensure it is in the correct classpath subdirectory。
solution
This may be a compatibility issue between SpringBoot version, JDK version, and IDEA version.
- First look at the java version under the pom file (originally I am 17 and IDEA2020 does not support JDK17)
- Go to Settings and check the version (originally it was 1.5 and you can see that it doesn’t correspond)
-
Go to Project and check the version (my computer is equipped with JDK8)
-
The above three local versions should be unified and then look at which version SpringBoot is using (I originally chose the latest version 3. few here)
The JDK version required by SpringBoot3.
So if the JDK version installed on your computer is 1.8, you need to choose SpringBoot version 2.7.8