spring tool suite: class file has wrong version 61.0, should be 52.0

22 views Asked by At

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

0

There are 0 answers