I have completely followed [Setting up the development environment](https://reactnative.dev/docs/environment-setup) for the **react-native project**, now when I am running the first app from Andriod studio **run BUTTON** it installs and runs perfectly. The problem comes when I run the command  `yarn react-native run-android` it throws the following error:

---

info JS server already running

info Installing the app...

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

```

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://reactnative.dev/docs/environment-setup>. Run CLI with --verbose flag for more details.

```
    Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this co

```

---

[snapshot is here](https://i.stack.imgur.com/dydbG.png)

**My jdk path:**
C:\Program Files\Java\jdk-15.0.1;
C:\Program Files\Java\jdk-15.0.1\bin;

My question is:
===============

If the jdk path is invalid then why it is running in android studio?