본문 바로가기

Tech/[Trouble Shooting] Logs

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH 오류

요약

inteliJ가 아니라 로컬에서 스프링 부트 애플리케이션을 빌드한 후 웹 서버를 띄워보는 작업중 발생한 오류이다.

로컬에 jdk가 설치되어 있지 않고 환경 변수가 적절히 설정되어 있지 않은 것이 원인일 것 같아서 설정을 했더니 해결됐다.

 

 

해결

1. 자신에게 맞는 jdk 버전을 찾아준다.

나는 InteliJ에서 jdk 17를 기준으로 작업해서 아래에서 다운로드 받았다.

https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html

 

Java Archive Downloads - Java SE 17

WARNING: These older versions of the JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production. For production use Oracle recommends downloading th

www.oracle.com

 

2. 보통 별도 설정을 하지 않으면 아래와 같은 폴더에 jdk 가 설치된다.

C:\Program Files\Java

 

3. 아래와 같이 윈도우에서 환경변수를 추가해 주면 된다.

3-1. 내 PC > 속성

 

3-2. 고급 시스템 설정 클릭

 

3-3. 아래와 같이 환경변수를 추가해 준다.