Fetch and store output from a subprocess in Java
问题 I'm working on something that requires me to start to subprocess(command prompt) and execute some commands on it. I need to fetch the output from the subprocess and store it in a file or String. here's what I have done so far, and it doesn't work: public static void main(String args[]) { try { Runtime RT = Runtime.getRuntime(); String command = "cmd /c start javap java.lang.String"; File file = new File("write.txt"); Writer output = new BufferedWriter(new FileWriter(file)); BufferedReader br