2

If a user executes foo.exe on his computer, is there a way to terminate foo.exe using a Java program?

Edit: To clear things up, I am talking about a process that was not created by the Java app.

Kara
  • 6,115
  • 16
  • 50
  • 57
Anonymous Person
  • 219
  • 1
  • 4
  • 9

1 Answers1

4

Looks like you are on Windows .

The command to kill a process is: taskill or tskill depending your Windows version .

tskill yourprocessname

executed by java

Runtime.getRuntime().exec(new String[]{"tskill", "foo"});
ProfessionalAmateur
  • 4,447
  • 9
  • 46
  • 63
Dapeng
  • 1,704
  • 13
  • 25