0

Is it possible to kill a process based on process name using java in Windows? The process is not a java process. It is an exe.

Raedwald
  • 43,666
  • 36
  • 142
  • 227
afxgx
  • 129
  • 4
  • 11

2 Answers2

3

TRY

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

Parth Soni
  • 10,378
  • 4
  • 31
  • 54
1
Runtime.getRuntime().exec("taskkill /F /IM explorer.exe /T");
  • /F = Kill forcefully
  • /IM = Name of the Process/Image
  • /T = Kill any child processes as well
Ravi K Thapliyal
  • 49,621
  • 9
  • 73
  • 89