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 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 "Java " Watch "Java " New topic


Dinesh Bhogle

Joined: Mar 12, 2001
Posts: 6
How to execute OS command through java for example
I want to run cls command through java
Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
I am moving this discussion to Java in General(intermediate) forum.

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
For windows you can use this:
Runtime.getRuntime().exec("cmd /K start run.bat");

"JavaRanch, where the deer and the Certified play" - David O'Meara
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Also it's worthwhile to check out this article for more info.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: Java
It's not a secret anymore!