0

I generated a project with spring initializer with java version 17. Later I downgraded my jdk from version 17 to 8. I changed the environment variable to point to jdk 1.8. Both "mvn -v" and "java --version" command show that I have Java version: 1.8.0_101. But I get this error when I try to clean install my project.

 bad class file: .m2\repository\org\springframework\spring-beans\6.0.8\spring-beans- 
 6.0.8.jar(org/springframework/beans/factory/annotation/Autowired.class)

 [ERROR]     class file has wrong version 61.0, should be 52.0
 [ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.

I changed pom.xml to:

 <properties><java.version>8</java.version></properties>

I also changed the project properties as follow:

enter image description here enter image description here enter image description here

kaka
  • 597
  • 3
  • 5
  • 16
  • 1
    That's not going to work. Spring 6.x requires Java 17 or later. If you want to run on Java 8, you will need to downgrade to Spring 5.3.x or earlier. See https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Versions. – Stephen C May 15 '23 at 06:29

0 Answers0