File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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




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

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

I agree. Here's the link:
subject: run Dos commands in java app
It's not a secret anymore!