Results 1 to 3 of 3
  1. #1
    birnie2525 is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default a hard question about process

    Hi, I am running a processing in my program and the program needs to wait for the process until it finishes. While the processing is executing, a file is automatically written and it is opened as a window, but the window does not close until I mannully close it. Is there any method/code to close the window when the process is done?

    Process proc = Runtime.getRuntime().exec( "ls "+ something);
    proc.waitFor();

    thanks!

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    Is the window a component you brought up as part of your application? If so, you can call 'dispose' on the window object to mak eit go away.

  3. #3
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    6

    Default

    Process.waitFor() waits until the process terminates. If the process is a GUI application, it will normally terminate only when its window is closed. You can forcibly close the process using Process.destroy(), but you'll need to check that it's done whatever it was supposed to do first.

Similar Threads

  1. Static (having a hard time)
    By maknib in forum New To Java
    Replies: 4
    Last Post: 11-02-2010, 07:05 AM
  2. a really hard sorting program can you help ??
    By splash128 in forum New To Java
    Replies: 4
    Last Post: 10-19-2010, 02:48 PM
  3. How hard is it.....
    By neilp123 in forum New To Java
    Replies: 4
    Last Post: 07-22-2010, 04:21 PM
  4. Replies: 5
    Last Post: 12-21-2009, 01:17 PM
  5. Extreme nooby having hard time with this app
    By asterix350z in forum New To Java
    Replies: 2
    Last Post: 12-05-2007, 07:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •