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.

3
  • 4
    What's the point? It's already been executed :D Commented Dec 16, 2011 at 5:04
  • I really should have seen that coming. :P Commented Dec 16, 2011 at 5:14
  • 1
    This may be relevant: stackoverflow.com/q/81902/576139 Commented Dec 16, 2011 at 5:20

1 Answer 1

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"});
Sign up to request clarification or add additional context in comments.

1 Comment

So you would run this with the same arguments you would use in the command line? (taskkill /im "foo.exe")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.