[Solved] nacos Startup Error: Please set the JAVA_HOME variable in your environment

Nacos is registered as a service in centos7, but it cannot be started

report errors

Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better!

reason

The java and javac of the installed JDK are not in the nacos startup script startup.sh (mine is under /opt/java/jdk1.8.0_333/)

terms of settlement

Add Java path to startup.sh

[ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/opt/java/jdk1.8.0_333

Restart the service successfully

Read More: