I have the following code throw an IOException, when it tries to execute
a DOS op. sys. command (dir) :
public class MyTest {
public static void main (String[] args) {
Runtime myOpSys = Runtime.getRuntime();
try {
myOpSys.exec("dir");
} catch (Exception e) {
System.err.println("Op. Sys. command failed\n");
e.printStackTrace();
System.err.println("\n");
System.exit(-1);
}
}
}
Print out of exception:
java.io.IOException: CreateProcess: dir error=2
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Win32Process.java:64)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:272)
at java.lang.Runtime.exec(Runtime.java:195)
at java.lang.Runtime.exec(Runtime.java:152)
at MyTest.main(MyTest.java:31)
* Any ideas why it's doing this?
Regards,
Cem.
Sent via Deja.com
http://www.deja.com/
Runtime myOpSys = Runtime.getRuntime();
myOpSys.exec("cmd /c dir");
Rgds,
Cem.
In article <917nnl$bvr$1...@nnrp1.deja.com>,