Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to execute a CLI command from Java program  RSS feed

 
Miguel Antonioli
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm trying to execute a CLI command (i.e.: "C:\dir > output.txt") from inside a Java program. After hours of unsuccessful search, I turn to anyone of you who can help me to do such task. Any help/direction is greatly appreciated. Thanks in advance.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the Runtime class.

Layne
 
Michael Lloyd Lee
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dir is not an application, but rather a shell built-in.


When Runtime Exec Won't
[ September 09, 2005: Message edited by: Michael Lloyd Lee ]
 
Miguel Antonioli
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys, let me try your suggestion.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My master criminal friend Kayser,

Welcome to JavaRanch!

You may not have carefully read our naming policy on the way in. It requires that you use a full, real (sounding), first and last name for your display name. The name of a well-known fictional character won't do. You can change your display name [URL=http://www.coderanch.com/forums/user/edit here.[/URL] Thanks for your cooperation!
 
Miguel Antonioli
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Testing.. testing..

EDIT: It's fixed. Thnx for the reminder.
[ September 11, 2005: Message edited by: Miguel Antonioli ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!