启动tomcat报 Neither the JAVA_HOME nor the JRE_HOME environment

上一篇 / 下一篇  2018-03-21 09:21:50 / 个人分类:tomcat

Linux上部署jdk和tomcat后,用shell命令(放在其他机器上进行远程操作时)启动时/usr/local/apache_tomcat/bin/startup.sh,报 Neither the JAVA_HOME nor the JRE_HOME environment的错误,但本地机器启动/usr/local/apache_tomcat/bin/startup.sh却没有问题。
解决此问题:修改startup.sh,添加source /etc/profile。远程启动命令:nuhup /usr/local/apache_tomcat/bin/startup.sh &。能正常启动了。

jdk和tomcat同时安装到一台机器上时的环境变量设置是:
vim env.sh
#!/bin/bash

echo 'export export JAVA_HOME=/usr/local/jdk1.8.0_161' >> /etc/profile
echo 'PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile
echo 'CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar' >> /etc/profile
echo 'export JAVA_HOME' >> /etc/profile
echo 'export PATH' >> /etc/profile
echo 'export CLASSPATH' >> /etc/profile
source /etc/profile

TAG:

 

评分:0

我来说两句

Open Toolbar