IOException: CreateProcess: dir error=2
Hi
I want to run a simple shell command "dir" on cygwin thru java class. My code is as follows :-
public class CygJava {
public static void main (String args[]){
File workDir = new File("c:/cygwin/bin");
try {
Runtime systemShell = Runtime.getRuntime();
Process shellOutput = systemShell.exec("dir", null, workDir);
InputStreamReader isr = new InputStreamReader(shellOutput.getInputStream());
BufferedReader br = new BufferedReader (isr);
String line = null;
System.out.println("<OUTPUT>");
while((line = br.readLine()) != null ) {
System.out.println(line);
}
System.out.println("</OUTPUT>");
int exitVal = shellOutput.waitFor();
System.out.println("Process Exit Value : "+exitVal);
}catch (IOException ioe) {
System.err.println(ioe);
} catch (Throwable t) {
t.printStackTrace();
}
}
}
On running this program , i get the error as :-
java.io.IOException: CreateProcess: dir error=2
Could anyone tell me as to why is this error occuring ?
Thanks

