• Post Reply Bookmark Topic Watch Topic
  • New Topic

Use of waitFor() method after exec()

 
Gaelle SMITS
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just like it says in the JavaDocs, waitFor returns after the process is finished.
Debugging a program that uses exec is really tricky - I recommend that you create a separate utility class (such as a JavaBean) that performs the exec function and test it in an off-line situation before trying to integrate with a JSP.
That way you can see all the error messages, etc.
Bill
 
Gaelle SMITS
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, thanks, I'll go and try this !
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!