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);
        }

    }
}

 

posted @ 2019-08-05 14:14  嵌入式实操  阅读(221)  评论(0编辑  收藏  举报