안드로이드 스튜디오 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

안드로이드 스튜디오 ERROR: JAVA_HOME is not set and no java command could be found in your PATH

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

.

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

.
감사합니다.

댓글

안드로이드 스튜디오 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.라는 오류가 뜹니다,,,ㅜ

안드로이드 스튜디오 ERROR: JAVA_HOME is not set and no java command could be found in your PATH

2

안드로이드 스튜디오 ERROR: JAVA_HOME is not set and no java command could be found in your PATH

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

댓글

안드로이드 스튜디오 ERROR: JAVA_HOME is not set and no java command could be found in your PATH

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

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

3

안드로이드 스튜디오 ERROR: JAVA_HOME is not set and no java command could be found in your PATH

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

댓글

4

안드로이드 스튜디오 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.라는 오류가 뜹니다!!

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

댓글

안드로이드 스튜디오 ERROR: JAVA_HOME is not set and no java command could be found in your PATH

5

안드로이드 스튜디오 ERROR: JAVA_HOME is not set and no java command could be found in your PATH

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

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

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

댓글

안드로이드 스튜디오 ERROR: JAVA_HOME is not set and no java command could be found in your PATH

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

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

6

안드로이드 스튜디오 ERROR: JAVA_HOME is not set and no java command could be found in your PATH

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

좋은 하루 보내세요!!

댓글

Skip to content

Hello Guys How are you all? Hope You all are fine. I just Installed Latest Android Studio in my windows machine trying to run the existing project. But it gives an error like this: ERROR: JAVA_HOME is not set and no ‘java’ command could be found in your flutter PATH. in flutter. So today Here I come with all possible solutions for this error.

We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.

  • How JAVA_HOME is not set and no ‘java’ command could be found in your flutter PATH Occurs ?
  • How to Solve JAVA_HOME is not set and no ‘java’ command could be found in your flutter PATH Error?
  • Solution 1
  • Solution 2: How to Set JAVA_HOME Path
    • How to Set JAVA_HOME Path In Windows.
    • How to Set JAVA_HOME Path In Ubuntu
    • How to Set JAVA_HOME Path In macOS
  • Summery
    • Also Check Out Below Tutorials

I just Installed Latest Android Studio in my windows machine trying to run the existing project. But it gives an error like this:

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 to Solve JAVA_HOME is not set and no ‘java’ command could be found in your flutter PATH Error?

  1. How to Solve JAVA_HOME is not set and no 'java' command could be found in your flutter PATH Error?

    To solve JAVA_HOME is not set and no 'java' command could be found in your flutter PATH If you have installed Android Studio from the website and not using snap, run flutter config --android-studio-dir=/usr/local/android-studio. Just open your terminal. Run this command flutter config –android-studio-dir=' flutter doctor That's It.

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

    To solve JAVA_HOME is not set and no 'java' command could be found in your flutter PATH If you have installed Android Studio from the website and not using snap, run flutter config --android-studio-dir=/usr/local/android-studio. Just open your terminal. Run this command flutter config –android-studio-dir=' flutter doctor That's It.

Solution 1

If you have installed Android Studio from the website and not using snap, run flutter config --android-studio-dir=/usr/local/android-studio

  1. Just open your terminal.
  2. Run this command flutter config –android-studio-dir='<path to android studio>
  3. flutter doctor
  4. Thats It.

If Still your problem not resolved then just follow Solution 2 to set your JAVA_HOME path.

Solution 2: How to Set JAVA_HOME Path

How to Set JAVA_HOME Path In Windows.

  1. Download Java JDK from here and install it.
  2. Open Search, type in “environment variable”, and choose “Edit the system environment variables”.
  3. Click on “Environment Variables…”.
  4. Click on “New”.
  5. Fill in the “variable name” field with “JAVA_HOME”.
  6. Fill in the “variable value” with the path to where Java is installed on your computer. (for me it was under “C:\Program Files\Java\<jdkversion>”)
  7. Click “OK” and close all dialogs.
  8. Restart your IDE / Terminal. (do not skip this step)

How to Set JAVA_HOME Path In Ubuntu

To Set JAVA_HOME / PATH for a single user, Login to your account and open .bash_profile file

$ vi ~/.bash_profile

Set JAVA_HOME as follows using syntax export JAVA_HOME=<path-to-java>. If your path is set to /usr/java/jdk1.5.0_07/bin/java, set it as follows:

export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java

Set PATH as follows:

export PATH=$PATH:/usr/java/jdk1.5.0_07/bin

Feel free to replace /usr/java/jdk1.5.0_07 as per your setup. Save and close the file. Just logout and login back to see new changes. Alternatively, type the following command to activate the new path settings immediately:

$ source ~/.bash_profile

OR

$ . ~/.bash_profile

Verify new settings:

$ echo $JAVA_HOME $ echo $PATH

Tip: Use the following command to find out exact path to which java executable under UNIX / Linux:

$ which java

Please note that the file ~/.bashrc is similar, with the exception that ~/.bash_profile runs only for Bash login shells and .bashrc runs for every new Bash shell.

How to Set JAVA_HOME Path In macOS

In Mac OSX 10.5 or later, Apple recommends to set the $JAVA_HOME variable to /usr/libexec/java_home, just export $JAVA_HOME in file ~/. bash_profile or ~/.profile.

Open the terminal and run the below command.

$ vim .bash_profile export JAVA_HOME=$(/usr/libexec/java_home)

save and exit from vim editor, then run the source command on .bash_profile

$ source .bash_profile $ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home

Summery

So, It’s All About ERROR: JAVA_HOME is not set and no ‘java’ command could be found in your flutter PATH. in flutter Error. I hope this tutorial helps you solve your error. Please Comment Below if You stucks anywhere with my code.

Also Check Out Below Tutorials

  • Could not resolve all files for configuration ‘classpath’. Could not find lint-gradle-api.jar
  • Flutter plugin not installed; this adds Flutter specific functionality
  • TextField inside of Row causes layout exception: Unable to calculate size
  • PluginRegistry cannot be converted to FlutterEngine In Flutter
  • How To Make Round button with text and icon in flutter?