• Post Reply Bookmark Topic Watch Topic
  • New Topic

Runtime in JSP  RSS feed

 
Arun Prasath
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Buddies,

I have a JSP which i use to kick start a Unix command using Runtime object as below. Coded inside scriptlet.




This command will take 4 or 5 minutes to really finish executing in Unix box.
I have specified the code to wait for the process to complete. Actually i don't want to wait and i want to let the jsp page continue to do.

If I commented out the line p.waitFor() , the command in the rt.exec() does not run in the Unix box. If it is not commented, it works fine.

Could anyone tell me if i do any mistake I do here, or tell me how to make it run without waiting?

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For one thing, if you create a process with exec() you must consume the stdout and stderr output streams that process creates. If you dont, it may just sit there forever.

This is all covered in the JavaDocs for Process and is frequently remarked on.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!