1、修改/etc/rc.d/rc.local

#vi /etc/rc.d/rc.local


2、在/etc/rc.d/rc.local文件最后添加两行脚本:

export JAVA_HOME=/usr/local/jdk1.7.0_03
/usr/local/apache-tomcat-7.0.32/bin/startup.sh start


3、修改rc.local文件为可执行:

#chmod +x rc.local