Anders Tornblad created KAFKA-6855:
--------------------------------------
Summary: Kafka fails to start due to faulty Java version detection
Key: KAFKA-6855
URL: https://issues.apache.org/jira/browse/KAFKA-6855
Project: Kafka
Issue Type: Bug
Components: core
Affects Versions: 1.1.0
Environment: Ubuntu 18.04
Java 10
Reporter: Anders Tornblad
After downloading fresh installations of ZooKeeper and Kafka, and then starting
ZooKeeper and Kafka the way that is recommended on
[http://kafka.apache.org/documentation/#quickstart] the following error message
is shown:
{{Unrecognized VM option 'PrintGCDateStamps'}}
I found the error in the kafka-run-class.sh file, where the Java version is
determined and put in the JAVA_MAJOR_VERSION variable. My Java runtime reports
the version as openjdk version "10.0.1" 2018-04-17, which makes the
JAVA_MAJOR_VERSION value be "10 2018-04-17" instead of just "10". That makes
the subsequent if statement fail.
I found the following line to fix the problem:
{{JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version
"([^.-]*).*/\1p')}}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)