4

I am setting up Kafka in my local. I have unzipped the 2.12 version and started zookeeper. Zookeeper is up and running but when I am trying to start kafka using the command .\bin\windows\kafka-server-start.bat .\config\server.properties , it is not showing any output.

I have also tried in git bash using the command bin/kafka-server-start.sh config/server.properties , it is giving error as

/c/kafka/kafka_2.12-2.1.0/bin/kafka-run-class.sh: line 306: C:\Program: No such file or directory.

Can you please help me with the solution.

gameon67
  • 3,981
  • 5
  • 35
  • 61
anurag
  • 61
  • 1
  • 2

3 Answers3

13

I use git bash on windows, and run the scripts in kafka_2.12-2.2.0\bin (not kafka_2.12-2.2.0\bin\windows).

Add double quotes around the JAVA term, in line 306.

exec "$JAVA" $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@"

If that does not help, add "set -x" at the top of the "kafka-run-class.sh" script to see the real problem.

#!/bin/bash
set -x
Sagan
  • 2,033
  • 2
  • 14
  • 12
3

If you are unzipping kafka in a windows machine, I recommend you to run launch zookeeper and kafka server via windows cmd terminal...

Thus, please run both commands from the "windows" folder:

First, launch zookeeper:

C:\DevTools\kafka_2.12-2.4.1\bin\windows>zookeeper-server-start.bat ..\..\config\zookeeper.properties 

Then, kafka server:

C:\DevTools\kafka_2.12-2.4.1\bin\windows>kafka-server-start.bat ..\..\config\server.properties

Important to mention that if you would use git bash on a windows machine to launch zookeeper and the kafka server you may face some errors regarding to the construction of the $CLASSPATH in "kafka-run-class":

$ ./zookeeper-server-start.sh ../config/zookeeper.properties
C:\Program Files\Java\jdk1.8.0_241/bin/java
C:/Program Files/Java/jdk1.8.0_241/lib;C:/Program Files/Java/jdk1.8.0_241/jre1.8.0_151/lib;:/c/DevTools/kafka_2.12-2.4.1/bin/../libs/activation-1.1.1.jar:/c/DevTools/kafka_2.12-2.4.1/bin/../libs/aopalliance-repackaged-2.5.0.jar:/c/DevTools/kafka_2.12-2.4.1/bin/../libs/argparse4j-0.7.0.jar:/c/DevTools/kafka_2.12-2.4.1/bin/../libs/audience-annotations-0.5.0.jar:/c/DevTools/kafka_2.12-2.4.1/bin/../libs/commons-cli-1.4.jar:/

Therefore, the scripts wont be able to run the jars.

Documentation http://kafka.apache.org/quickstart

Nelson Dias
  • 111
  • 7
0

This worked for me:

Go to line 306 and change $CLASSPATH to

cygpath -wp $CLASSPATH
Vinoth Krishnan
  • 2,925
  • 6
  • 29
  • 34
Nomair Ghanem
  • 524
  • 4
  • 12