Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of waitFor() method after exec()

Status
Not open for further replies.

Gaelle

Programmer
Jun 20, 2001
62
0
0
FR
Hi !

I don't manage to use the waitFor() method the way I want :
I have a web application in JSP which makes a command line call by :
Process p = r.exec(command);
This command creates a file I have to dispaly in a frame.
So I have to wait for the file to be created before I load it in my frame.
I have written :
int respro = p.waitFor();
But it doesn't seem to really wait, and I get the URL not found message in my frame.

Can anyone explain me exactly how waitFor() works, and if it's what I need ?

Thanks !

Gaelle, from France.
 
Are you sure that your error comes from the
Code:
WaitFor
method ?
I mean, can't it be the command that you execute that doesn't work ?
Did you check the
Code:
respro
value that returned the
Code:
WaitFor
method (it's your commande return value) ? Water is not bad as soon as it stays out human body ;-)
 
I am having a similar problem with waitFor(). You are not
alone! I have never had this happen but I believe the
waitFor is supposed to wait for the child process to end
before parent continues. My exitValue is '0' as soon as the
frame opens and stays zero after it closes. If this is not
the way to wait for the
Process p = Runtime.getRuntime().exec(command);
p.waitFor();
then I would sure like to know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top