启动Nacos报错信息:Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better!”
解决方法:
先查找jdk的安装路径:
ls -lrt /etc/alternatives/java
/etc/alternatives/java -> /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/jre
或者
ll /usr/lib/jvm
第一步
cd /home/dev/nacos/nacos/bin
vim startup.sh
##在顶部添加变量JAVA_HOME
JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/jre
第二步
修改第30行 [ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$JAVA_HOME
第三步
##修改/etc/profile vim /etc/profile
##追加以下内容 export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/jre export JRE_HOME=${JAVA_HOME} export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:$PATH
立刻生效全局变量文件
source /etc/profile
启动Nacos
sh startup.sh -m standalone
浏览器访问测试:
ip:8848/nacos