1. 编辑
vi /etc/rc.d/rc.local
添加如下命令(注意jdk和tomcat路径):
export JAVA_HOME=/usr/java/jdk1.8.0 export PATH=$JAVA_HOME/bin/:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$CLASSPATH export CATALINA_HOME=/usr/local/tomcat7/ /usr/local/tomcat7/bin/catalina.sh start
保存
2. 设置权限
chmod -R 775 /etc/rc.d/rc.local
3. 重启测试
reboot