[Solved] zookeeper Cluster error: Error: JAVA_HOME is not set and java could not be found in PATH.

zookeeper Cluster error: Error: JAVA_HOME is not set and java could not be found in PATH.

When learning to build a zookeeper cluster, you will often start and stop the zookeeper service and check the service status. Starting one by one is very troublesome. It is very convenient to start through a shell script
when the problem comes, there is no problem when starting the zookeeper service alone. An error will be reported when starting it through a script:

Solution:
in the bin directory under the zookeeper directory, there is a zkEnv.sh file, add your own path of JAVA_HOME in front of the code.

export JAVA_HOME=/opt/module/jdk1.8.0_261

 

Read More: