Printing Runtime exec() OutputStream to console
问题 I am trying to get the OutputStream of the Process initiated by exec() to the console. How can this be done? Here is some incomplete code: import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.io.Reader; public class RuntimeTests { public static void main(String[] args) { File path = new File(\"C:\\\\Dir\\\\Dir2\"); String command = \"cmd /c dir\"; Reader rdr = null; PrintStream prtStrm = System.out