tomcat报错catalina.sh: line 401: /usr/java/jdk1.7.52/bin/java: No such file or directory
将生产服务器的Tomcat目录打包过来后解压后,启动Tomcat后,发现如下问题:
# ./shutdown.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.7.52
/usr/local/tomcat/bin/catalina.sh: line 401: /usr/java/jdk1.7.52/bin/java: No such file or directory
其实安装的是jdk-8u102-linux-x64.rpm,其实并没有所谓的/usr/java/dk1.7.52目录,而是/usr/java/jdk1.8.0_102/
发现/etc/profile文件下的jar_home指向错误,
于是修改vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_102/
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export SANP_HOME=/home/aaa
使配置生效,重新启动tomcat即可
source /etc/profile