1.直接启动jar包,则在控制台上打印日志信息。linux窗口关闭则进程挂掉
java -jar test_mysql-0.0.1-SNAPSHOT.jar
2.为了在能够一直在后台运行,请参照以下启动命令。
nohup java -jar ./test_mysql-0.0.1-SNAPSHOT.jar >weather_log.text 2>&1 &
nohup 指在后台运行
>weather_log.text 2>&1 & 指将日志写入weather_log.text文件
./test_mysql-0.0.1-SNAPSHOT.jar 指用jps查看进程的时候便于区分,如下图。也可以用jar包的全路径 /root/yx/test_mysql-0.0.1-SNAPSHOT.jar
[root@i ~]# jps
12324 test_mysql-0.0.1-SNAPSHOT.jar