Spring | class file has wrong version 61.0, should be 52.0 오류
Spring | class file has wrong version 61.0, should be 52.0 오류
Spring 빌드간 발생한 에러
spring | gradle
에러발생
52.0 은 JDK 1.8 (jdk 8)로 java컴파일 시 발생하는 에러로
jdk버젼 충돌로 인하여 발생하는 문제입니다.
java: cannot access org.springframework.boot.SpringApplication
bad class file: /Users/gaetaeng/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot/3.3.3/f34dba93611823e521800a47043267715184911b/spring-boot-3.3.3.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.
해결방법
각 세팅값을을 17버젼에 맞춰서 수정해주거나 스프링 버젼을 1.8 버전에 맞춰서 수정해주어야합니다.
저는 빌드 세팅값을 17버전에 맞춰 수정하는 방향으로 해결하였습니다.
IntelliJ 설정
1. File - Project Structure - Project 탭의 SDK 버젼 및 Language Level(언어 수준) 17로 설정
2. SDK탭의 Java 버전 17로 설정
3. Intellij IDEA - Preferences (환경 설정) - Build, Excecution, Deployment - Compiler - Java Compiler
Project bytecode version 17 설정
4. 좌측 Build Tools(빌드도구) - Gradle 에서
Gradle JVM 버전 17 설졍