How To stop an Executed Jar file

前端 未结 9 1870
时光说笑
时光说笑 2021-02-03 23:20

It feels like a dumb question to ask, but i cant seem to figure it out. when i run a *.jar file on windows it doesnt apears in the taskmanager processes. how can i terminate it

9条回答
  •  旧时难觅i
    2021-02-04 00:10

    spring boot start/stop sample (on Windows OS).

    start.bat

    @ECHO OFF
    call run.bat start
    

    stop.bat:

    @ECHO OFF
    call run.bat stop
    

    run.bat

    @ECHO OFF
    IF "%1"=="start" (
        ECHO start your app name
        start "yourappname" java -jar -Dspring.profiles.active=prod yourappname-0.0.1.jar
    ) ELSE IF "%1"=="stop" (
        ECHO stop your app name
        TASKKILL /FI "WINDOWTITLE eq yourappname"
    ) ELSE (
        ECHO please, use "run.bat start" or "run.bat stop"
    )
    pause
    

提交回复
热议问题