Engr.Aftab Ufaq
Engr.Aftab Ufaq

Reputation: 6384

JAVA_HOME is set to an invalid directory react-native

i have installed the openjdk11 with Chocolatey and set JAVA_HOME TO C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot\bin but when i try to run the command npx react-native run-android it give and error

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot\bin

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

it was working fine 2 weeks ago but now its not working .

Upvotes: 3

Views: 2155

Answers (1)

g00se
g00se

Reputation: 4296

There should be no '\bin' in JAVA_HOME. It's the installation directory. OTOH, it can be in PATH, by prepending %JAVA_HOME%\bin; That will mean that your new installation (defined by JAVA_HOME) will take precedence for execution.

Upvotes: 3

Related Questions