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 How to run dos command throught JAVA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to run dos command throught JAVA" Watch "How to run dos command throught JAVA" New topic

How to run dos command throught JAVA

ramesh gosala

Joined: Sep 30, 2006
Posts: 7
Hi am Ramesh....

How to run the DOS command like(DIR, CLR, XCOPY)through Java Program,
pls send me sample code for me
Class RunDos_Command{

Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

This has nothing to do with SCJP. Try Runtime.exec()

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Welcome to the ranch!

After many tries I've given up on ever explaining this better than When Runtime Exec Wont. About all I'd add is that Java 5 introduced ProcessBuilder which is easier to use than runtime.exec().
[ October 01, 2006: Message edited by: Stan James ]

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
I agree. Here's the link:
subject: How to run dos command throught JAVA
It's not a secret anymore!