React Native: JAVA_HOME is not set and no 'java' command could be found in your PATH : <p>I've followed step by step the official <a href="https://facebook.github.io/react-native/docs/getting-started.html" rel="noreferrer">Getting Started</a>. I started from a clean linux install and installed everything required as per the "Building Projects with Native Code" tab. I have also read the troubleshooting section. I've already created the project using the terminal.</p>

<p>This is the error when I run <code>react-native run-android</code>:</p>

<pre><code>    Starting JS server...
    Building and installing the app on the device (cd android &amp;&amp; ./gradlew installDebug)...

    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/android-setup.html
</code></pre>

<p>It does not find JAVA_HOME because the latest versions of Android Studio don't require Java to be installed in the system. Instead an internal JRE is used. </p>

<p><strong>Duplicate disclaimer</strong>: I've already read <a href="https://stackoverflow.com/questions/34375542/error-java-home-is-not-set-and-no-java-command-could-be-found-in-your-path">this question</a>. This is not what I want. I know how to set the Java home. I just want to run the react project WITHOUT having to install a separate Java.</p>

<p>Questions:</p>

<ol>
<li>How could I find the internal Java inside the Android Studio folder so that I could point JAVA_HOME to it?</li>
<li>If not possible, could I open and run the project inside the <code>android</code> folder with Android Studio? How would I refresh this project after modifying the React JavaScript code in the parent folder?</li>
</ol>
