LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to know a process status by it's ID (http://www.linuxquestions.org/questions/linux-networking-3/how-to-know-a-process-status-by-its-id-749797/)

sivareddy_jntu 08-24-2009 03:20 AM

How to know a process status by it's ID
 
hai,
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.


Thanks,
siva.

jlliagre 08-24-2009 03: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 07:28 AM

I have a similar answer to the one I gave when I apparently misunderstood your question the previous time you asked:
http://www.linuxquestions.org/questi...18#post3652318
(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 06:43 AM.