Search code examples
windowscommand-lineenvironment-variablesapache-zookeeperjava-home

JAVA_HOME is incorrectly set when launching Zookeeper on Windows


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?


Solution

  • Quote the path.

    "%JAVA_HOME%\bin\java.exe"