help required in using getRuntime.exec() and JFrames

Discussion in 'Java' started by Rohit Gupta, Jun 24, 2005.

  1. Rohit Gupta

    Rohit Gupta Guest

    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
    Rohit Gupta, Jun 24, 2005
    #1
    1. Advertising

  2. "Rohit Gupta" <> wrote in message
    news:...
    > 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?


    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 http://www.iviz.com/
    Matt Humphrey, Jun 24, 2005
    #2
    1. Advertising

  3. Rohit Gupta

    Rohit Gupta Guest

    Thanks, got the culprit......it was getting blocked....
    Using this it worked...
    Process p = Runtime.getRuntime().exec(command);
    p.getInputStream().close();

    Rohit
    Rohit Gupta, Jun 24, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. robich
    Replies:
    0
    Views:
    421
    robich
    Jul 15, 2003
  2. Zsolt Koppany
    Replies:
    2
    Views:
    7,099
    SaintMagoo
    Mar 5, 2011
  3. sanjay
    Replies:
    4
    Views:
    2,697
  4. Dave Neuendorf
    Replies:
    5
    Views:
    6,716
    Anthony Borla
    Feb 25, 2005
  5. Rohit Gupta
    Replies:
    12
    Views:
    2,038
    Rohit Gupta
    Jun 26, 2005
Loading...

Share This Page