Obviously, JAVA_HOME is configured normally, but the error is still reported:
hadoop@hadoop-1:/data/apache-zookeeper-3.7.1-bin/bin$ sh zkServer.sh start zkServer.sh: 78: /data/apache-zookeeper-3.7.1-bin/bin/zkEnv.sh: [[: not found -p: not found java is /data/hadoop/jdk1.8.0_202/bin/java Error: JAVA_HOME is not set and java could not be found in PATH.
Solution:
Replace it with ./zkServer.sh start
or bash zkServer.sh start