Hadoop on Windows - "Error JAVA_HOME is incorrectly set."

like the other answers, your java environment path must not contain space. The solution is as follows:

  1. In the cmd line, charge the directory that contain the jdk (in my case C:\Program Files\Java\jdk1.8.0_73).
  2. execute the following line "for %I in (.) do echo %~sI" to display the short name of your installed jdk (in my case C:\PROGRA~1\Java\JDK18~1.0_7)
  3. in the file "hadoop-env.cmd", change the line "JAVA_HOME=%JAVA_HOME%" with "JAVA_HOME=C:\PROGRA~1\Java\JDK18~1.0_7".
  4. run again the file "hadoop-env.cmd" and it will work correctly.

Use "%JAVA_HOME%" in conf\hadoop-env.cmd


 set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131\

Above configuration was throwing same error as yours. I updated above with below in hadoop-env.cmd which is infact SFN

set JAVA_HOME=C:\Progra~1\Java\jdk1.8.0_131\

This allowed me to change/have different java version than that of system.


If your JAVA_HOME path contains spaces, you must use the Windows 8.3 Pathname