'Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVersion=2.13.6'

I've searched a lot for solving this issue but nothing worked for me.

I'm trying to install Kafka on my linux machine (Mint) and I've reached to this step where I start the Kafka broker:

$ sudo /usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties 

but I get the famous annoying error:

Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVersion=2.13.6'

Any help please?

P.S. I've downloaded the Kafka binary (not the source)



Solution 1:[1]

According to the output, you have not downloaded the binary package, as it is asking you to compile/package the code.

Or you have moved the kafka-run-class.sh binary somewhere where it cannot reference the necessary CLASSPATH for running the server

You don't need sudo to run Kafka ... Try downloading/starting outside of /usr/local first - https://kafka.apache.org/quickstart

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1