1
votes

When using the command:

/usr/local/kafka/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

I get the following error:

Unrecognized option: --create
Error: Could not create the Java Virtual Machine
Error: A fatal exception has occurred. Program will exit.

I am following the instructions in the Kafka: The Definitive Guide book.

Thanks in advance.

2
have you tried to run the correct script: /usr/local/kafka/bin/kafka-topics.sh? In your question you are not including the last "s".jose.goncabel
Also you are using both the --describe as well as the --create command, which does not work. If leave one of them out it should work (depending on what you want to do, create or describe a topic).Sönke Liebau
The missing "s" was a typo in the question, not my command, thanks for pointing it out.Ryan
Removing --describe still results in the same error message.Ryan
Clearly you have some basic system setup issue where your Java isn't setup or that Kafka shell script isn't setup correctly. I don't have that book, but have you tried the basic Confluent Platform debian/rpm packages? docs.confluent.io/current/clay

2 Answers

2
votes

I had the same problem as yours. I was able to make it work by adding sudo in the script: /usr/local/kafka/bin/kafka-topics.sh

exec sudo $(dirname $0)/kafka-run-class.sh kafka.admin.TopicCommand "$@"
1
votes

You should check whether you have downloaded the correct (compiled) version.

This may happen if you are trying to run the script in the source code version.