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 .
CodePudding user response:
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.