learning java 读写其他进程的数据
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ReadFromProcess { public static void main(String[] args) throws IOException { Process p = Runtime.getRuntime().exec("javac"); var br = new BufferedReader(new InputStreamReader(p.getInputStream())); String buff = null; while ((buff = br.readLine()) != null) { System.out.println(buff); } } }