Hello,
> I'm asking about how to excute DOS command via Java code ?
Start with this:
Runtime.getRuntime().exec("/path/to/batchFile.bat");
The thing you are executing must always resolve to the path of some
file you are going to run.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#exec(java.lang.String)
You can use another form of exec in the same class where you send in a
string array to encapsulate arguments to the script as different array
positions. However, even the form above that accepts a String only can
also include space separated arguments.
Good luck,
Rob
:)
franco - 05 Nov 2006 03:22 GMT
if you are using java5 process builder is very nice too. it comes in
handy when you want to work with standard input and error, etc.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html
// minimal invocation:
new ProcessBuilder("myCommand", "myArg").start();
> Hello,
>
[quoted text clipped - 15 lines]
> Rob
> :)
>Hi all,
>
[quoted text clipped - 3 lines]
>
>thank you
Take a look at Runtime.exec()
Jim