Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

help required in using getRuntime.exec() and JFrames

Thread view: 
Rohit Gupta - 24 Jun 2005 14:20 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.