Error: package org.apache.kafka.clients.producer not

I am new to kafka. When I run this command

javac -cp "C:\kafka\kafka_2.11-0.10.2.0\libs\kafka-clients-0.10.2.0.jar" *.java

      

I am getting the error

Error: package org.apache.kafka.clients.producer does not exist

+3


source to share


2 answers


I got an answer.

So, post here if anyone else needs it.

The following command works well

javac -classpath ".; C: \ kafka \ kafka_2.11-0.10.2.0 \ libs \ kafka-clients-0.10.2.0.jar;" * .java



But actually we have to use the following to compile

javac -classpath ".; C: \ kafka \ kafka_2.11-0.10.2.0 \ libs *;" * .java

and run the class file this

java -classpath ".; C: \ kafka \ kafka_2.11-0.10.2.0 \ libs *;" FileName SimpleProducer

0


source


In addition to @ Abhishek's answer: -

First download the Kafka client library dependencies from [ https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients]

Copy the folder org

and paste it into lib

our main Kafka directory folder.



Then run the above two commands

Also it can be controlled by simple commands: -

javac -cp libs *.java

java -cp libs SimpleProducer *topicname*

      

0


source







All Articles