2

I'm trying to run react native cli and I'm coming across the error below:

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_102

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

I was getting different build errors yesterday and when trying to debug I set the JAVA_HOME to their answer on SO. Since, I have been getting the error above and found no solution. Most of the answers consist of removing \bin but as you can see that is not set in the current directory.

I have tried reinstalling Java and setting it to the known path but the error did not change.

Is it strange that I had no Java file prior to manual installation this morning and the cli was running?

Grateful for any advice and help.

8
  • is that the correct path to your jdk installation ? Commented Apr 19, 2022 at 8:26
  • Is it strange that CLI was working before? No. There was a Java Runtime installed before. In Windows, this was probably pointed to by this path C:\ProgramData\Oracle\Java\javapath. Commented Apr 19, 2022 at 8:28
  • baeldung.com/java-home-on-windows-7-8-10-mac-os-x-linux Commented Apr 19, 2022 at 8:34
  • @hfontanez are you suggesting I point JAVA_HOME to the path you have specified above? Commented Apr 19, 2022 at 9:00
  • 1
    given information is not helpful, mostly confusing. Please add to question: 1) WHERE you installed JAVA; 2) the content of JAVA_HOME (e.g. echo %JAVA_HOME%); 3) the content of PATH; 4) result of `dir "%JAVA_HOME%" Commented Apr 19, 2022 at 9:53

1 Answer 1

6

Obviously, you are misconfigured. it's my pc JAVA_HOME. enter image description here

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.