Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get process related information in java on any OS

807580Nov 24 2009 — edited Jan 27 2010
Hi,

I am trying to write a code which can get information of any process which mainly includes PID, Start time, CPU utilazation, memory utilization. I know that this can be done using Runtime.exec() and firing ps or top commands on it. But this will be only linux specific. Can some one help me in writing better code which is really platform independent and will give information of any process on any platform. In other words, is there any alternative to Runtime.exec()

Example: If i fire "java myProcessInfo <processName>" as a command, then be this command run on any OS it should give me all the details of the process which i am looking for.

Thanks,
Bhaskar
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 24 2010
Added on Nov 24 2009
17 comments
187 views