How to find the process id of a running Java process on Windows? And how to kill the process alone?

后端 未结 8 1709
庸人自扰
庸人自扰 2021-01-30 21:59

I want to kill the particular Java process in Windows, like in Linux (ps -aux to get processid and then kill processid to kill the process).

8条回答
  •  孤独总比滥情好
    2021-01-30 22:23

    In windows XP and later, there's a command: tasklist that lists all process id's.

    For killing a process in Windows, see:

    Really killing a process in Windows | Stack Overflow

    You can execute OS-commands in Java by:

    Runtime.getRuntime().exec("your command here");
    

    If you need to handle the output of a command, see example: using Runtime.exec() in Java

提交回复
热议问题