How to call an external script/prgm and wait until execution is finished?

Discussion in 'Java' started by Sven Fischer, Mar 8, 2012.

  1. Sven Fischer

    Sven Fischer Guest

    I want to call from inside a java program an external script (resp. prgm) and wait
    until the execution is finished (successfuly or not).

    How can I do this?

    For simplicity assume the external script is either an DOS batch scipt (Windows) or shell script (Linux).

    How can I ask from inside the Java program for the return/exit code?

    Sven
     
    Sven Fischer, Mar 8, 2012
    #1
    1. Advertising

  2. Sven Fischer

    Arne Vajhøj Guest

    Re: How to call an external script/prgm and wait until executionis finished?

    On 3/8/2012 11:20 AM, Sven Fischer wrote:
    > I want to call from inside a java program an external script (resp. prgm) and wait
    > until the execution is finished (successfuly or not).
    >
    > How can I do this?
    >
    > For simplicity assume the external script is either an DOS batch scipt (Windows) or shell script (Linux).
    >
    > How can I ask from inside the Java program for the return/exit code?


    http://docs.oracle.com/javase/6/docs/api/java/lang/Process.html#waitFor()

    http://docs.oracle.com/javase/6/docs/api/java/lang/Process.html#exitValue()

    Arne
     
    Arne Vajhøj, Mar 8, 2012
    #2
    1. Advertising

  3. Sven Fischer

    Roedy Green Guest

    On 08 Mar 2012 16:20:03 GMT, (Sven Fischer)
    wrote, quoted or indirectly quoted someone who said :

    >I want to call from inside a java program an external script (resp. prgm) and wait
    >until the execution is finished (successfuly or not).


    see http://mindprod.com/jgloss/exec.html
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    One of the most useful comments you can put in a program is
    "If you change this, remember to change ?XXX? too".
     
    Roedy Green, Mar 9, 2012
    #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. =?Utf-8?B?QnJpYW4gUnVwZXJ0?=

    Please wait until the debuggee has finished loading, then try aga

    =?Utf-8?B?QnJpYW4gUnVwZXJ0?=, Aug 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    604
    =?Utf-8?B?QnJpYW4gUnVwZXJ0?=
    Aug 13, 2004
  2. Replies:
    23
    Views:
    886
    Rogan Dawes
    Aug 10, 2005
  3. bearsprite
    Replies:
    3
    Views:
    612
    Dennis Lee Bieber
    Dec 12, 2006
  4. pj
    Replies:
    1
    Views:
    301
    Mark A. Odell
    Jul 16, 2004
  5. Replies:
    10
    Views:
    480
    Richard Bos
    Aug 12, 2004
Loading...

Share This Page