When I run this program itdisplays the following text instead of the dir dump why? This is what it displays.
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
It should also display the dir out put but it does now why?
The code
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class ExecuteWindowsCommandThread implements Runnable {
public ExecuteWindowsCommandThread(String command) {
}
@Override
public void run() {
try {
final Process p = Runtime.getRuntime().exec("cmd c/ dir");
//p.waitFor();
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = input.readLine()) != null) {
System.out.println(line);
}
System.out.println("Done2");
}
catch (IOException e) {
e.printStackTrace();
}
System.out.println("Done");
}
}