java – 如何获取exe文件生成的控制台输出?

不使用重定向文件(“>”,“>>”)
Process p = Runtime.getRuntime().exec("executable.exec");

BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));

String line;
while ((line = input.readLine()) != null) {
  System.out.println(line);
}
https://stackoverflow.com/questions/1251039/how-can-i-get-the-console-output-generated-by-a-exe-file

转载注明原文:java – 如何获取exe文件生成的控制台输出?