How to get process related information in java on any OS
807580Nov 24 2009 — edited Jan 27 2010Hi,
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