PDA

View Full Version : Java: how to find out that a process freezes


Cyrus
October 28th, 2005, 05:21 PM
Hi,

I opened an external process in my java application. Sometimes this process freezes so my program can't work on. Is there any way to find out the process is freezing?

So I can kill the process manually ...

jvictor
November 7th, 2005, 05:22 AM
May sound weird, but this is what i can think of now

u must run the line of code taht executes this external process as a thread , now when u use Runtime.getRuntime.execXX u will be gettign a return value

init the var that will handle the retun value to some value taht the sytem will never return , after n seconds of executing the thread , chk the val of this var. if its the val that u have filled in during init ,then ur process msut have hung.. then

System.err.println("BLAH BLAH BOOHOO BOOHOOO");

did u try this ?

I know its v wierd .. :)

Cyrus
November 7th, 2005, 06:28 PM
Thank you - I actually use this solution now ...