title: Cmd/React Native can't detect my JAVA_HOME environment variables
body: <p>I'm trying to create a React Native app for Android. I use bash from the command line in Windows 10. I browse to the location of my React Native project and then run "react-native run-android". But then I get an error like this:</p>
  
  <pre><code>$ react-native run-android
  info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
  Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
  info Starting JS server...
  /bin/sh: 1: adb: not found
  info Launching emulator...
  error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
  warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
  info Installing the app...
  
  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 Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
  Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
      at checkExecSyncError (child_process.js:601:13)
      at execFileSync (child_process.js:621:13)
      at runOnAllDevices (/mnt/c/users/lenovo/documents/repositories/upself rn/upself/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
      at &lt;anonymous&gt;
      at process._tickCallback (internal/process/next_tick.js:188:7)
  </code></pre>
  
  <p>TL;DR it tells me to set the environment variable for JAVA_HOME. AFAIK.</p>
  
  <p>The problem is I've already set the JAVA_HOME since I installed the Windows 10 in my laptop which was months ago. I use JDK 12 and have developed few native Android app using Android Studio using this same laptop and never have I encountered any missing JAVA_HOME issue. </p>
  
  <p>This is what I've tried to try to solve this issue:</p>
  
  <ul>
  <li><p>Run the cmd as administrator</p></li>
  <li><p>Set the JAVA_HOME to <code>c:\Program Files\Java\jdk-12.0.2\</code> and the one in Android Studio default SDK location <code>C:\Users\lenovo\AppData\Local\Android\Sdk</code>. Both dont work.</p></li>
  <li><p>Restart my laptop and cmd (done it multiple times but it still doesnt work).</p></li>
  <li><p>Put a quotation mark between the path (found this in a stack overflow question).</p></li>
  </ul>
  
  <p>I've read many questions in stack overflow but none of those works.</p>
  
  <p>So, could anyone help me to solve this problem? Why is it unable to detect the environment path?</p>