Possible Duplicate:
Outputting result of “dir” to console in Java
I'm probably doing something silly here. Please help. Here's the simple code:
new ProcessBuilder("dir").start();
Error message: java.io.IOException: Cannot run program "dir": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
I'm trying to use a ProcessBuilder to execute unix commands on a unix box but I'm developing on a Windows machine so decided to try a few basic windows commands before proceeding. Unfortunately, it's not working. Please let me know if I'm doing something wrong. I've also tried setting the directory of process builder to something like "C:\" and also tried using Runtime i.e. Runtime.getRuntime().exec("dir"); but I get exactly the same error.