Author
How to kill a windows process using java?
Jon Lee
Ranch Hand
Joined: Mar 04, 2005
Posts: 134
On windows platform, how to use java code to kill a process?? For example, I start a process called flashfxp.exe, can I use java code to kill it?? Pls give some hints, many thnx!
SCJP 5.0 - 98% (2007)<br />SCWCD 1.4 - 97% (2007)
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
posted Sep 02, 2005 01:34:00
0
If you find a command-line tool that kills processes (not sure if those exist for Windows), you can use java.lang.Runtime.exec to execute it.
Android apps – ImageJ plugins – Java web charts
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12921
You can download a "kill" utility for Windows here: Sysinternals PsKill
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Jon Lee
Ranch Hand
Joined: Mar 04, 2005
Posts: 134
Many thnx, mates! That works!
Kudret Serin
Ranch Hand
Joined: Aug 02, 2005
Posts: 165
If you find a command-line tool that kills processes (not sure if those exist for Windows), you can use java.lang.Runtime.exec to execute it.
Taskkill command. You can see the usage with taskkill /? Cheers.
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16692
Originally posted by Kudret Serin: Taskkill command. You can see the usage with taskkill /? Cheers.
The taskkill command only works for windows xp professional. Believe it or not, it is not even built into windows xp home edition. Luckily, most business use the professional edition. If you are using windows 2000 or 2003, I would look to see if the resource kit is installed. Again, most business client seems to install this package. In this package, there is a "kill" command. Henry
Books: Java Threads, 3rd Edition , Jini in a Nutshell , and Java Gems (contributor)
subject: How to kill a windows process using java?