Error: package org.apache.kafka.clients.producer not
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
source to share
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*
source to share