Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

  1. 报错描述
    情景一
    1Panel在"主机-->进程守护"通过命令"nohup /opt/tomcat/bin/startup.sh > /opt/supersivor/tomcat/nohup.log &"创建守护进程,运行日志如下:
    #----------------------------------------------------------
    Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
    At least one of these environment variable is needed to run this program
    #----------------------------------------------------------
    执行"ps -ef | grep -i tomcat"查不到tomcat相关进程,说明tomcat启动失败
    
    情景二
    "java -version"输出如下,说明JDK已经安装且配置环境变量
    java version "11.0.11" 2021-04-20 LTS
    Java(TM) SE Runtime Environment 18.9 (build 11.0.11+9-LTS-194)
    Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)
    
    情景三
    执行"startup.sh"或者"nohup /opt/tomcat/bin/startup.sh > /opt/supersivor/tomcat/nohup.log &"均可正常启动tomcat
  2. 解决方法
    "startup.sh"首行添加"export JAVA_HOME=/opt/jdk"

你可能感兴趣的:(linux,java,tomcat)