1、安装配置java+tomcat(其他略)
/etc/profile配置环境变量
export JAVA_HOME=/usr/local/jdk-17.0.7 export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar export PATH=$JAVA_HOME/bin:$PATH
2、/etc/rc.d/rc.local增加执行权限
chmod +x /etc/rc.d/rc.local
3、在/etc/rc.d/rc.local中增加执行语句
source /etc/profile su tomcat -c "/usr/local/apache-tomcat-9.0.30/bin/startup.sh"
注意:要在/etc/rc.d/rc.local文件中增加 source /etc/profile 不然不能成功执行
标签:JAVA,tomcat,etc,rc,自启动,HOME,local From: https://www.cnblogs.com/xue0123/p/17414662.html