How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

Android Resolver  ERROR: JAVA_HOME ~

Unity에서 Android Resolver를 사용하다 보면 
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 
Please set the JAVA_HOME variable in your environment to match the 
location of your Java installation. 

라는 에러를 볼 수 있다. JAVA_HOME에 대한 환경변수값이 설정되어 있지 않아서 그런 경우인데 

이럴 경우에는 JAVA_HOME의 환경 변수만 잡아주면 해결이 된다.

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?
How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

[Edit] -[Preferences]-[External Tools]- JDK의 경로를 Copy Path 한다.

JDK가 설치가 안되어있으면 설치를 진행하면되고 Unity Hub에서는 모듈 설정에서 추가가 가능하다.

[Unity Hub] - [설치] - [모듈 추가] - [Android Build Support]-[OpenJDK]를 설치한다.

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

JAVA_HOME 환경 변수는 [시스템] - [고급 시스템 설정] -[고급] -[환경변수] 항목에서 추가가 가능하다.

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

[시스템 변수]-[새로 만들기]를 누르고 변수 이름 "JAVA_HOME" 복사한 JDK 경로를 붙여 넣기 한다.

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

[시스템 변수]- Path에  %JAVA_HOME%\bin 를 추가한다.

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

[cmd]- java-version으로 확인한다.

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

다시 Android Resolver 를 Focus Resolve 해본다. 정상적으로 잘되는 것을 확인할 수 있다.

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

 ★

안녕하세요!! 강의 보고 배우고 있는 학생입니다!!

gradlew.bat build 입력을 하면 gradlew.bat: command not found라는 문구가 뜨는데 왜 그런 걸까용,.,? 

1

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

안녕하세요. pdh4963님, 공식 서포터즈 David입니다.

.

빌드하실 때, ./gradlew.bat build 가 아니라 ./gradlew build 로 명령을 입력하셔야 합니다:)

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

.
감사합니다.

댓글

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

그렇게 입력하면

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

Please set the JAVA_HOME variable in your environment to match the

location of your Java installation.라는 오류가 뜹니다,,,ㅜ

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

2

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

당연히 환경 변수에 JAVA_HOME 설정 완료하였고 명령 프롬프트에서 javac, javac -version 등을 입력하여 설치 완료된 것도 확인하였습니다,,

댓글

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

gradlew 파일이 위치한 곳에서 java -version, javac -version 명령을 실행하셨을 때 버전이 정상적으로 출력되시나요?

출력되신다면 캡쳐 부탁드립니다.

3

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

혹시 말씀하신 gradlew 파일이 위치한 부분이 hello-spring 이 부분이 맞나요?? 일단 그 위치에서 java -version 했을 경우의 출력입니다!!

댓글

4

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

아 ㄱ리고 명령 프롬프트에서 gradlew build 입력했을 경우에는

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk-11.0.13\bin

Please set the JAVA_HOME variable in your environment to match the

location of your Java installation.라는 오류가 뜹니다!!

(위에 댓글에 쓴 오류는 터미널로 실행했을 경우에 뜨는 오류입니다)

댓글

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

5

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

감사합니다!! 해결되었습니다

근데 cmd에서는 성공적으로 출력이 되는데 터미널에서는 오류가 뜹니다,, 혹시 이유가 뭔지 알 수 있을까요??

(혹시 몰라 gradlew build, ./gradlew build 둘 다 해봤습니다)

댓글

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

terminal에 환경변수 세팅이 안 되어 있어서 그럴 수 있습니다.

리눅스 환경에서 환경변수를 세팅하는 방법을 찾아보시고 JAVA_HOME을 세팅해주시면 됩니다.

6

How do you fix error JAVA_HOME is not set and no Java command could be found in your path?

계속 질문하는데도 친절하게 답변해주셔서 감사합니다!!

좋은 하루 보내세요!!

댓글