Results 1 to 3 of 3
  1. #1
    Cyrus is offline Member
    Join Date
    Mar 2014
    Posts
    18
    Rep Power
    0

    Default Wait for external application to close

    I am writing a console application that is to make use of the system editor on *NIX. For that I have written a method which writes a string to a file, launches an editor to change that file, and then reads the file again. The problem is the call to run the editor doesn't wait for that application to have closed.

    Java Code:
    Runtime.getRuntime().exec(editorcmd + " " + tmpfn);
    I need the program to wait for the editor to have finished.
    Last edited by Cyrus; 06-16-2014 at 05:17 AM.

  2. #2
    kneitzel is offline Senior Member
    Join Date
    Feb 2014
    Posts
    447
    Rep Power
    1

    Default Re: Wait for external application to close

    What kind of research did you do to solve this issue?

    Did you look at the documentation of the Runtime class to have a closer look at the exec method? What does this method return? Did you check that class, too? These are some straight forwward steps in my eyes that quickly leads to a valid solution.

    Just try these steps and tell us if you have problems finding the solution.

    With kind regards,

    Konrad

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: Wait for external application to close

    This is the only research you need:

    When Runtime.exec() won't | JavaWorld
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Java Application Flow (pause & wait?)
    By quazareth in forum New To Java
    Replies: 3
    Last Post: 04-20-2012, 04:57 AM
  2. Getting the applet image from an external application
    By somanayr in forum Java Applets
    Replies: 2
    Last Post: 10-13-2010, 02:37 AM
  3. Executing external command through JSP
    By rudranee in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-21-2009, 10:22 AM
  4. Executing an external java program
    By arunsubramanian in forum Advanced Java
    Replies: 5
    Last Post: 02-06-2009, 08:49 AM
  5. executing external programs
    By Levish2002 in forum AWT / Swing
    Replies: 0
    Last Post: 09-10-2008, 08:04 PM

Tags for this Thread

Posting Permissions

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