1、cmd
java -jar test.jar
關閉的話ctrl+c或者直接關閉小黑窗
2、腳本
@echo off start javaw -jar D:\RCDCore-Boot-Boost-0.0.1-SNAPSHOT.jar exit
或
@echo off java -jar xxx.jar pause
@echo off: 當執行失敗的時候,不打印失敗信息,根據自己需要選用
停止
@echon off taskkill /PID 進程號 -t -f pause
/PId 后跟的是進程id,-t -f 是強制殺死。
或
根據程序名結束進程
@echo off taskkill -f -t -im javaw.exe exit
但這個會殺死當前全部的進程。
或
手動查看端口號找到進程
netstat -ano | findstr "8080"
殺掉
taskkill /pid 5588 /f
note: /f
強制結束進程
https://www.cnblogs.com/leaves1024/p/11301843.html
https://blog.csdn.net/hanshanyunhai/article/details/106272995