• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i get all the existing processes in a system?

 
Laura Antanas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
of course using java language.....

Thanks a lot,
Laura
 
Scott Dunbar
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would have to "go native" to do this. Java itself does not include a way to do this because doing it in Windows vs. Unix is bad enough. Now toss in AS/400's and VMS based systems and the methods and permission issues are very different.
[ June 06, 2006: Message edited by: Scott Dunbar ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only in some platform-specific way. You can execute an external program like UNIX's "ps", or you can use a platform-specific native API using the Java Native Interface. But there's no portable, Java-only way to do this.
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling Runtime.exec("ps") returns a java.lang.Process object. You can ask this object to give you a java.io.InputStream and obtains the ps output.

I have not tested this, because I am currently working on Windows, I will see about it when I get home. But I think this might work:



Best regards,
Edwin Dalorzo.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic