linux 启动nacos报错_linux下启动Nacos报错解决:which: no javac in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/
Posted 最小的帆也能远航
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux 启动nacos报错_linux下启动Nacos报错解决:which: no javac in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/相关的知识,希望对你有一定的参考价值。
报错信息:
which: no javac in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
readlink: missing operand
Try 'readlink --help' for more information.
dirname: missing operand
Try 'dirname --help' for more information.
ERROR: Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! !!
查找原因:
输入echo $JAVA_HOME结果为空,说明没有配置java环境变量
解决办法:
配置JAVA环境变量
1.找到jdk安装路径
[root@localhost bin]# ls -lrt /usr/bin/java
lrwxrwxrwx 1 root root 22 Mar 15 09:59 /usr/bin/java -> /etc/alternatives/java
[root@localhost bin]# ls -lrt /etc/alternatives/java
lrwxrwxrwx 1 root root 73 Mar 15 09:59 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/jre/bin/java
[root@localhost bin]# cd /usr/lib/jvm
[root@localhost jvm]# ll
total 4
drwxr-xr-x 3 root root 4096 Mar 15 09:59 java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64
lrwxrwxrwx 1 root root 21 Mar 15 09:59 jre -> /etc/alternatives/jre
lrwxrwxrwx 1 root root 27 Mar 15 09:59 jre-1.8.0 -> /etc/alternatives/jre_1.8.0
lrwxrwxrwx 1 root root 35 Mar 15 09:59 jre-1.8.0-openjdk -> /etc/alternatives/jre_1.8.0_openjdk
lrwxrwxrwx 1 root root 51 Mar 15 09:59 jre-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64 -> java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/jre
lrwxrwxrwx 1 root root 29 Mar 15 09:59 jre-openjdk -> /etc/alternatives/jre_openjdk
2.在/etc/profile文件下添加以下代码并执行
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
[root@localhost ~]# source /etc/profile
3.重新执行nacos启动脚本:
[root@localhost bin]# ./startup.sh
/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64//bin/java -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/mynacos/nacos/logs/java_heapdump.hprof -XX:-UseLargePages -Djava.ext.dirs=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64//jre/lib/ext:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64//lib/ext:/mynacos/nacos/plugins/cmdb:/mynacos/nacos/plugins/mysql -Xloggc:/mynacos/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dnacos.home=/mynacos/nacos -Dloader.path=/mynacos/nacos/plugins/health -jar /mynacos/nacos/target/nacos-server.jar --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/mynacos/nacos/conf/ --logging.config=/mynacos/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
nacos is starting with cluster
nacos is starting,you can check the /mynacos/nacos/logs/start.out
说明启动成功!可以到logs下查看日志。
以上是关于linux 启动nacos报错_linux下启动Nacos报错解决:which: no javac in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/的主要内容,如果未能解决你的问题,请参考以下文章
启动springboot项目连接nacos控制台报错com.alibaba.nacos.api.exception.NacosException: dataId invalid