Running Kafka on Windows 10 fails: The system cannot find the path specified
I faced this issue while running the kafka-server-start.bat command. I double checked to ensure that there was no spaces in the kafka binaries path as well as correct syntax in JAVA_HOME.
Finally realized that the issue was due to a space in the JAVA_HOME path.
C:\Program Files\Java\jdk1.8.0_144
There is a space between Program and Files. I changed the directory of Java and updated the JAVA_HOME variable to
C:\Java\jdk1.7.0_51
This change solved my issue. I used the setx command to change the value in JAVA_HOME.
setx -m JAVA_HOME "C:\Java\jdk1.7.0_51"
I had this problem as well. In my case I have java installed in C:\Java\bin and JAVA_HOME defined as
JAVA_HOME=c:\Java\bin
I needed to change
c:\Tools\kafka_2.12-2.2.0\bin\kafka-run-class.sh
lines 224 to 229 from this
# Which java to useif [ -z "$JAVA_HOME" ]; then JAVA="java"else JAVA="$JAVA_HOME/bin/java"fi
to this:
# Which java to useif [ -z "$JAVA_HOME" ]; then JAVA="java"else JAVA="$JAVA_HOME/java"fi
because it was assigning java to C:\Java\bin/bin/javawhich was then failing on 306 of the same file.
BTW: I'm using a git bash shell in windows. This allows me to run the bin/*.sh scripts instead of the bin/windows/*.bat scripts
Also I changes the value of the dataDir in
C:\Tools\kafka_2.12-2.2.0\config\zookeeper.properties
to
dataDir=C:\\Tools\\kafka_2.12-2.2.0\\zookeeper-data
Turns out that this error is being thrown by kafka-run-class.bat
because the path to JAVA_HOME
in system variables is malformed (in my case, I had added /bin to it.) Removing /bin from the path, and having it be an existing Java installation folder, makes everything run fine.