JAVA_HOME is incorrectly set when launching Zookeeper on Windows

bachr picture bachr · Aug 20, 2014 · Viewed 13k times · Source

I'm having a "JAVA_HOME is incorrectly set" error when launching Zookeeper on windows with zkServer.cmd while it is correctly set! When I issue %JAVA_HOME% I got C:\Program Files\Java\jdk1.7.0_45 which is the correct directory of the java instalation.

I suspect the problem is due to the space in program files, as when I issue %JAVA_HOME%\bin\java.exe (the command used in zkEnv.cmd) I got:

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

How I can fix this?

Answer

Fueled By Coffee picture Fueled By Coffee · Aug 20, 2014

Quote the path.

"%JAVA_HOME%\bin\java.exe"