Hi,
Can anyone tell me why I am getting error when running the below command.
$ sbt compile
[error] /root/kafka-sbt/file.java:5:1: class SimpleProducer is public, should be declared in a file named SimpleProducer.java
[error] public class SimpleProducer {
[error]
[error] public static void main(String[] args) throws Exception {
[error]
[error] String topicName = "SimpleProducerTopic";
[error] String key = "Key1";
[error] String value = "Value-1";
[error]
[error] Properties props = new Properties();
[error] props.put("bootstrap.servers", "localhost:9092,localhost:9093");
[error] props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
[error] props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
[error]
[error] Producer<String, String> producer = new KafkaProducer<>(props);
[error]
[error] ProducerRecord<String, String> record = new ProducerRecord<>(topicName, key, value);
[error] producer.send(record);
[error] producer.close();
[error]
[error] System.out.println("SimpleProducer Completed.");
[error] }
[error] }
[error] (Compile / compileIncremental) javac returned non-zero exit code
[error] Total time: 30 s, completed Feb 10, 2020 11:56:36 AM