• Post Reply Bookmark Topic Watch Topic
  • New Topic

Executing dos commands  RSS feed

 
Ram Sateesh Talari
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I know how to run a dos command using java.. but I need to wait until the process is done with it's work. Even if I use waitFor() it's not waiting for it to finish... can someone help??

Cheers
Ram
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some times we set up separate threads to read the stdout and errout of the process. I guess I've only done this once, but it seemed more reliable to join these threads than to use waitFor(). Use the Ranch search tool to look for "StreamGobbler" in the streams & IO forum for some examples.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!