• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to kill a windows process using java?  RSS feed

 
Jon Lee
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15862
81
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can download a "kill" utility for Windows here:
Sysinternals PsKill
 
Jon Lee
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thnx, mates! That works!
 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22853
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!