Hello, I just wanted to know, is there a way to get a list of processes which are currently running in the Operating System. Thanks...
SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
I doubt there is a platform-independent way to do such a thing. In any case, I'm moving this to the Threads and Synchronization forum, where folks are most likely to have an idea...
There's no Java API for this. You have two choices: a platform-dependent JNI function that uses the native OS's mechanism for getting this list, or using Runtime.exec() to run some platform-dependent program that returns the list as text and then parsing the result.
Could you please give me any idea if I want to do this by Runtime.exec()...
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
posted
0
What operating system are you using?
"I'm not back." - Bill Harding, Twister
Ransika deSilva
Ranch Hand
Joined: Feb 18, 2003
Posts: 524
posted
0
I am using Windows 2000 platform. I don't mind doing this machine dependantly as well as using JNI. Please do help me with this. This is an assignment. Thanks.........
...and using pure Java you can track (to some degree) only the processes which your application have started by callimg Runtime.exec(...) If you need to track other processes, it will not work for you.
Ransika deSilva
Ranch Hand
Joined: Feb 18, 2003
Posts: 524
posted
0
Hello, Thank you very much for the answers. It really helps...........
Ransika deSilva
Ranch Hand
Joined: Feb 18, 2003
Posts: 524
posted
0
Hello, I am facing a problem. The link above which was given to me, provided me a source code written on C or C++. Could you please tell me which software do I have to use to run the program. Thanks....
Dmitry Melnik
Ranch Hand
Joined: Dec 18, 2003
Posts: 328
posted
0
C/C++ development tool like Microsoft Visual Studio (IMHO overkill for your task), or "gcc" http://gcc.gnu.org/