'JAVA_HOME is not set and no 'java' command could be found in your PATH
I am trying to build a react-native app on my mobile phone.
I do have environment path set in my environment variable

I have my phone in debugging mode with adb devices showing phone connected. My java path is C:\Program Files\Java\jdk-10.0.2
I get the below error on react-native run-android 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. Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html
Solution 1:[1]
Change the variable name to
PATH
instead of
JAVA_HOME
And you are good to go!
Solution 2:[2]
You are adding JAVA_HOME as a user variable. You need to add a new variable as JAVA_HOME under system variable and add JDK Path as variable value.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jaswant Singh |
| Solution 2 |
