Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

run Dos commands in java app

 
sitaram irrinki
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how we can run a ms-dos command by using a java program
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime

Runtime.exec(..)

Rene
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jesse Stearyl
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yea, it would go something like this.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic