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')