I'm trying to run Kafka locally. I've got Zookeeper installed and running. I've downloaded the binaries for Kafka 2.11-1.1.0. I've adjusted the location of the logs in server.config
, to a valid path. When I run .\bin\windows\kafka-server-start.bat .\config\server.properties
, I get an error that says
The system cannot find the path specified.
I can see that both those files exist on my computer in the proper locations-what should I be troubleshooting?
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"
As many have mentioned, this can happen if any of the kafka *.bat scripts that you run ( including zookeeper) refer to a bad JAVA_HOME system variable, or one containing a space.
You can solve this by changing JAVA_HOME to the shortened path name. For example
set JAVA_HOME=C:\Progra~1\Java\jdk-11.0.1
P.S.
For convenience, I created a CMD desktop shortcut that sets the JAVA_HOME to be right for Kafka, and CDs to my kafka installation. My Desktop shortcut is as follows:
%windir%\System32\cmd.exe /k set JAVA_HOME=C:\Progra~1\Java\jdk-11.0.1& f: & cd f:\kafka\kafka_2.12-2.2.0
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.
I facing same issue and fixed with below steps as following:
Make sure your environment variable as:
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_261
ZOOKEEPER_HOME=C:\apache-zookeeper-3.6.2
KAFKA_HOME=C:\kafka_2.13-2.7.0
Edit the 'Path' in system variable and type:%JAVA_HOME% / bin, %ZOOPKEEPER_HOME / bin and %KAFKA_HOME% / bin
Now, open the terminal, Run zoopkeeper and kafka
For Zoopkeeper: zkserver
For Kafka: bin\windows\kafka-server-start.bat .\config\server.properties
It runs without an any issues and errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With