java: cannot access org.springframework.boot.SpringApplication bad class file

Viewed 27
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.
2 Answers

If you have java 8 installed on your machine and if you go to the spring initializer website and create an application by selecting Spring boot 3.0.0 (SNAPSHOT) and packaging as Jar and version as 8, then generated zip file will have version as 11 on pom even though you selected version as 8. which means, your local machine is having java version 8, and the generated zip file is having version 11 on the pom.

enter image description here

Related