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
  • 5,650
  • 15
  • 48
  • 55
Anonymous Person
  • 209
  • 1
  • 3
  • 8

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
  • 3,967
  • 9
  • 41
  • 62
Dapeng
  • 1,652
  • 12
  • 25