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

[1134 byte] By [clueless@worka] at [2007-10-3 11:54:38]
# 1
I think this might be useful: http://forum.java.sun.com/thread.jspa?threadID=416069&tstart=120If not I would suggest searching the forum for others
zadoka at 2007-7-15 14:29:28 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...