1

I need a Java way to find a running OS process from which I know to name and path of the executable. I want to look whether it is running right now and I need a way to kill the process if I found it.

My Question is a similar to how-to-find-and-kill-running-win-processes-from-within-java but not restricted to windows.

Am I forced to do an implementation per platform or is there some trick/library/api I'm missing that can do this?

Community
  • 1
  • 1
Aksel Willgert
  • 11,367
  • 5
  • 53
  • 74
  • 4
    Theres no platform independent way of doing this afaik. – Perception Jan 22 '13 at 18:34
  • 2
    There seem to be some libraries mentioned here that might do what you are looking for: http://stackoverflow.com/questions/1192081/what-is-the-best-way-to-manage-unix-process-from-java – jcern Jan 22 '13 at 18:40

1 Answers1

5

The SIGAR library has some pretty cool support for stuff like this. It has java APIs for listing and killing system processes.

jtahlborn
  • 52,909
  • 5
  • 76
  • 118