https://kafka.apache.org/10/documentation/streams/quickstart
I'm trying to run my own application (on Linux) using Kafka Streams. I was able to successfully follow the instructions on their page and run the WordCountDemo application. Now I'm trying to use my own app (right now it is the same code, but I plan on doing something else with it) and when I write the command bin/kafka-run-class.sh com.zzz.WordCount I get Error: Could not find or load main class com.zzz.WordCount
I have my own WordCount.java like the following
/opt/kafka_2.12-1.0.0/src/main/com/zzz/WordCount.java
Is there anything else I need to do with my own app in order to be able to run it with kafka streams on my machine? Thanks.
You need to make sure that bin/kafka-run-class.sh finds your own class in the Java classpath.
Before you run bin/kafka-run-class.sh execute
export CLASSPATH="$CLASSPATH":"/opt/kafka_2.12-1.0.0/src/main/"
This should allow bin/kafka-run-class.sh to pick it up correctly.
I created the maven project containing the WordCountDemo.java program on my local machine. Executed the following steps
WordCount.jar. export CLASSPATH="$CLASSPATH":"/my/sever/dir/WordCount.jar"
Then the following command was executed without any problem.
bin/kafka-run-class.sh com.zzz.WordCountDemo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With