Search code examples
javaunixapache-kafkaapache-zookeeper

Cannot start zookeeper server. No jdk directory


I'm trying to start kafka on UNIX, but first I need to run zookpeer. I have kafka 2.12 version from https://www.apache.org/dyn/closer.cgi?path=/kafka/2.0.0/kafka_2.11-2.0.0.tgz I run command bin/zookeeper-server-start.sh config/zookeeper.properties, but I got an error:

/kafka_2.12-2.0.0/bin/kafka-run-class.sh: line 306: /project/multiar/jdk1.7.0_17_x64/bin/java: No such file or directory
/kafka_2.12-2.0.0/bin/kafka-run-class.sh: line 306: exec: /project/multiar/jdk1.7.0_17_x64/bin/java: cannot execute: No such file or directory.

I have Java 8 jdk in path:

openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

Why I cannot run zookeper server? Should I install jdk 7 or change something in .sh files?


Solution

  • I was trying to solve the same problem. It happened to me after an Ubuntu update (not sure completely)

    enter image description here

    This is how I resolved the problem

    1 Check the Java version

    enter image description here

    2 Check for all Java versions installed

    enter image description here

    3 Add JAVA_HOME to environment variables

    enter image description here

    enter image description here

    4 Check the JAVA_HOME

    enter image description here

    After I set the JAVA_HOME correctly zookeeper starts correctly (complete logs are not shown here)

    enter image description here