Killing a process using Java

前端 未结 8 1711
名媛妹妹
名媛妹妹 2020-11-22 11:08

I would like to know how to \"kill\" a process that has started up. I am aware of the Process API, but I am not sure, If I can use that to \"kill\" an already running proces

8条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 11:52

    On Windows, you could use this command.

    taskkill /F /IM .exe 
    

    To kill it forcefully, you may use;

    Runtime.getRuntime().exec("taskkill /F /IM .exe")
    

提交回复
热议问题