Rutime.getRuntime().exec(text)

Here is the deal. I have the code shown below. Works great.Gets the String tf.getText() and executes it. The problem is that the command (tf.getText()) is a command that may take a while (ie. 12 seconds). I want to System.out.println("Running...") before the command starts getting executed and a System.out.println("Execution Complete") after it has finished. I thought if I put the running println at SPOT A (see code) and the finished println at SPOT B it would do just that, but it doesnt do that, and now that I think about it, it makes sense and I understand why. Java is not waiting for that to finish, it calls on that command to execute and then goes on with its business. But I still want the println's. What do I do?

if (e.getSource() == run) {

try {

// SPOT A

Runtime.getRuntime().exec(tf.getText());

// SPOT B

}

catch (Exception ex) { }

}

thanks in advance.

[940 byte] By [armandfcdx] at [2007-9-26 4:06:13]
# 1
A possible solution would be to use the progress meters in Swing.
GLJdotcom at 2007-6-29 13:06:19 > top of Java-index,Archived Forums,Java Programming...
# 2
Hi,use waitFor() method of Process class:Process p = Runtime.getRuntime().exec(tf.getText());p.waitFor();Regards,Martin
edosoft at 2007-6-29 13:06:19 > top of Java-index,Archived Forums,Java Programming...