[JAVA/Spring Boot] Java 빌드 파일 실행 오류

이나영·2022년 5월 2일
0

Spring Boot

목록 보기
2/3

빌드 파일 실행 시 오류

✔️잘 실행될 때

  1. ./gradlew build
  2. cd build/libs : libs 폴더 안으로 들어간다.
  3. ls 폴더 안에 SNAPSHOT파일이 있는 지 확인한다.

  1. java -jar hello-spring-0.0.1-SNAPSHOT.jar

아래처럼 잘 실행되면 서버 배포 시 저 파일만 따로 복사해서 서버에 넣어주고 저렇게 실행시키면 서버에서도 spring 이 잘 동작하게 된다!


❌오류날 때

Exception in thread "main" java.lang.UnsupportedClassVersionError: hello/hellospring/HelloSpringApplication has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

실행 시 이런 에러가 뜬다면 OS에 설치된 자바 버전 때문일 확률이 높다.

version 55 = Java 11
version 52 = Java 8

참고 링크😮

에러 메세지를 읽어보면 version 52로 운영중이라고 하니 로컬PC에서 환경변수에 8버전을 삭제해주자.

그래도 안된다면,

여기도 Java 11로 잘 설정되었는지 봐주자.

profile
소통하는 백엔드 개발자로 성장하기

0개의 댓글