Need to solve ASAP ,leaving external program running and closing my app.
Hello, need to solve this ASAP
I'm calling an external program from my java code and ....
My caller program is a console based program
The program to be called is started by .sh script in unix/.bat in windows
The caller program performs the call to the second and the second program is started but the problem is the caller program never ends, it just waits to the called program ends its tasks and then it ends. I dont want this.
I want the second program be started and the caller program can ends without taking care in which moment the second program ends, of course in automatic way, with no final user ending the caller program.
Please help!
Israel
[706 byte] By [
isramireza] at [2007-11-27 4:00:54]

Thanks 4 answer,
Actually that happens when for example i call the calc.exe program in windows, below a kind of sample of what i'm doing:
public static void main(String[] args){
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec( "c:\\winnt\\system32\\calc.exe");
System.out.println("Hello World");
}
The program runs OK, calc.exe (the calc of windows) is well executed and actually the program prints the Hello World message with no delay but the problem is the program never ends, it waits until i close the calc.exe and then it performs the end................. why? how to solve this?
Thanks in advance!
Well, the following worked for me.
First - this bash script in /tmp/foo.sh:#!/bin/bash
xterm
And then I ran this program:package javaforum;
public class Background {
public static void main(String[] args) throws Exception {
Process pr = Runtime.getRuntime().exec("/tmp/foo.sh &");
}
}
and xterm came up for me, and "Background" exited.
Does that help?
G
> Thanks ggainey
>
> Issue solved by executing my app. out of the runtime
> of my IDE. it seems as the integrated debuger and
> ect. utilities where the cause of the "waiting the
> end of the second program..." now all is fine.
Huh. What IDE are you using? I ran mine under Eclipse 3.2 without a problem. I can kind of think of use-cases where the IDE would get in the way of Runtime.exec(), but I'm not completely convinced.
in any event - glad you got the problem fixed!
G