-   Linux - Networking (
-   -   How to know a process status by it's ID (

sivareddy_jntu 08-24-2009 04:20 AM

How to know a process status by it's ID
I have a java program,in which i need to know another process status.But that process is not subprocess of java program.How can i do this.

Any help would be appreciated highly.


jlliagre 08-24-2009 04:58 AM

I'm afraid you can do it with (pure) java. Of course, you can call native methods and/or run external programs from java to achieve the same.

johnsfine 08-24-2009 08:28 AM

I have a similar answer to the one I gave when I apparently misunderstood your question the previous time you asked:
(on rereading that thread, I don't know why I thought you wanted the calling program's own pid.)

But instead of /proc/self use /proc/PID replacing PID with the numeric pid of the process you want.

You can read files with ordinary java, so you don't need any native methods, external programs or special API. Of course the results will be fairly OS specific, but I expect any method of getting process status would give OS specific results.

All times are GMT -5. The time now is 11:08 PM.