1、修改/etc/rc.d/rc.local,使用vi /etc/rc.d/rc.local 命令
2、在/etc/rc.d/rc.local文件最后添加下面两行脚本
#java home
export JAVA_HOME=/usr/java/jdk1.8.0_60
#start tomcat
/usr/local/apache-tomcat-7.0.63/bin/startup.sh start
其中:
/usr/local/jdk1.7.0_03 为本机jdk安装目录
/usr/local/apache-tomcat-7.0.32/bin/startup.sh 为本机tomcat安装的目录
3、修改rc.local文件为可执行,如:chmod +x rc.local
Windows 开机启动 tomcat.bat
@echo off
@set CATALINA_HOME=D:\tools\apache-tomcat-7.0.61
@cd /d D:\tools\apache-tomcat-7.0.61\bin
@call service.bat install Tomcat7-1
@net start Tomcat7-1
@sc config Tomcat7-1 start= auto