配置tomcat的开机启动
1> 在centos7的/etc/rc.d/rc.local中加入:
(注意自己的路径)
#java environment
export JAVA_HOME=/usr/java/jdk1.8.0_161
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin
/home/tomcat/apache-tomcat-8.5.29/bin/startup.sh
1
2
3
4
5
2> 改变rc.local权限
chmod +x /etc/rc.d/rc.local
1
3> 重启后查看是否生效:
[[email protected] ~]# ps -aux | grep java
root 1178 1.7 6.0 3219444 113712 ? Sl 02:02 0:09 /usr/java/jdk-9.0.4/bin/java -Djava.util.logging.config.file=/usr/java/apache-tomcat-7.0.94/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Dignore.endorsed.dirs= -classpath /usr/java/apache-tomcat-7.0.94/bin/bootstrap.jar:/usr/java/apache-tomcat-7.0.94/bin/tomcat-juli.jar -Dcatalina.base=/usr/java/apache-tomcat-7.0.94 -Dcatalina.home=/usr/java/apache-tomcat-7.0.94 -Djava.io.tmpdir=/usr/java/apache-tomcat-7.0.94/temp org.apache.catalina.startup.Bootstrap start
root 1976 0.0 0.0 112712 976 pts/0 S+ 02:11 0:00 grep --color=auto java
---------------------
原文地址:https://www.cnblogs.com/ly570/p/11076203.html