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

风流意气都作罢 提交于 2020-07-18 08:47:51

问题


I am not able to run a Apache Kafka service due to a failure while trying to start a Zookeeper instance. I have downloaded and tried it with all 3 availabe downloads at the official site. (binarys and source) When i try to start zookeeper with

./bin/zookeeper-server-start.sh config/zookeeper.properties

I always get the same error message:

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

The same goes for (after starting a seperate zookeeper (not the build-in from kakfa) instance)

./bin/kafka-server-start.sh config/server.properties

I have tried it under Ubuntu 17.04 and 18.04. When i try this on a virtual machine using Ubuntu 16.04 it works.

Unfortunatly, all i found regarding this problem, was for Windows. Thank you for any help.


回答1:


In my case it has nothing to do with the binary or source cause both of them give that same "classpath is empty please build the project first" error. Its because there is a space in the path where kafka resides.




回答2:


I had the same issue, the problem was I was downloading the source of Kafka. So to make my Kafka server run, I downloaded the Kafka binaries and it worked for me.

Kafka binaries: http://mirror.cc.columbia.edu/pub/software/apache/kafka/1.1.0/




回答3:


We need to download kafka-binary and not the source Download Binary from mirror http://mirrors.estointernet.in/apache/kafka/2.2.0/kafka_2.11-2.2.0.tgz




回答4:


Try echo $CLASSPATH in the terminal, check if there is a Java in this system. Or maybe you need to install java




回答5:


Go to your terminal and run:

$ ./gradlew jar -PscalaVersion=2.11.12



回答6:


Please check scala version installed in your system. It should be scalaVersion=2.11.12.

Otherwise Download the kafka binary with installed scala version.




回答7:


I changed the path:

~/Documents/Formation/Moi/Big Data/Logiciels/kafka_2.12-2.4.1

to

~/Documents/Formation/Moi/Logiciels/kafka_binary

and it works (binary sources)




回答8:


I had the same issue. I solved it when removed the white spases from my folder name e.g "Kafka binary" -> "Kafka_binary".



来源:https://stackoverflow.com/questions/50197965/classpath-is-empty-please-build-the-project-first-e-g-by-running-gradlew-ja

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!