JAVA_HOME is set to an invalid directory:

Nagarajan M picture Nagarajan M · Jul 19, 2017 · Viewed 165k times · Source

I have set JAVA_HOME in my system C:\Program Files\Java\jdk1.8.0_ 131\bin; and I am trying to run cordova command( cordova build ) on command prompt, but I'm getting the error bellow. I have tried all the ways, but not able to resolve this issue:

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_ 131\bin;

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

Answer

Sagar Gangwal picture Sagar Gangwal · Jul 19, 2017

You should set it with C:\Program Files\Java\jdk1.8.0_12.

\bin is not required.