aspose file tools*
The moose likes Java in General and the fly likes run Dos commands in java app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "run Dos commands in java app" Watch "run Dos commands in java app" New topic
Author

run Dos commands in java app

sitaram irrinki
Ranch Hand

Joined: Feb 16, 2005
Posts: 158
how we can run a ms-dos command by using a java program
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Runtime

Runtime.exec(..)

Rene


Regards, Rene Larsen
Dropbox Invite
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Try searching the IO forum for "StreamGobbler", which addresses the tricky bits of reading the output from the command. Some commands require you to read the output even if you don't need it for your logic. Some of the examples in the old gobbler threads are pretty complete solutions.

If you're in Windows, open a command prompt and run "CMD /?" and "COMMAND /?". You'll need to know one or both of these to run so-called internal commands and a few other finicky programs.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Jesse Stearyl
Greenhorn

Joined: Jun 12, 2005
Posts: 4
Yea, it would go something like this.

 
jQuery in Action, 2nd edition
 
subject: run Dos commands in java app