Hi,
I am using getRuntime.exec() in Jframes, and running another another
java file by the exec() functions, the java file produces another file
after running. Now I need to display the output of this file on the
JFrame, but the output file contains null value until and unless I exit
the Frame, after which the output file contains the required text. I
tried repaint(), but that didn't work, what should I do?
TIA
Rohit Gupta
Matt Humphrey - 24 Jun 2005 15:26 GMT
> Hi,
>
[quoted text clipped - 4 lines]
> the Frame, after which the output file contains the required text. I
> tried repaint(), but that didn't work, what should I do?
It seems unusual that the exec does not finish until your Frame exits. It
suggests to me that you're either not giving the exec enough time to do its
job, or it's blocked waiting for your program to do something. As part of
running an exec, you need to simultaneously read standard out / standard
error from the program or it will block. If you show your exec code someone
may be able to determine if it's correct.
Cheers,
Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
Rohit Gupta - 24 Jun 2005 17:59 GMT
Thanks, got the culprit......it was getting blocked....
Using this it worked...
Process p = Runtime.getRuntime().exec(command);
p.getInputStream().close();
Rohit