1

我没有得到正确的答案..我的代码是

String s="java  -classpath MiniRA/ RegAlloc < MiniRA/4.miniIR";
Process pro2 = Runtime.getRuntime().exec(s); 
System.out.println("Okey");
BufferedReader in = new BufferedReader(new InputStreamReader(pro2.getInputStream()));
String line = null;
System.out.println("Okey");

while ((line = in.readLine()) != null) {
    text+=line;
text+="\n";
}
System.out.println(text);

但我得到的结果是一个非终止的输出窗口

koha@ubuntu:~/pjt_new/P3$ java demo

Okey

Okey

^Z

[1]+  Stopped                 java demo

koha@ubuntu:~/pjt_new/P3$ 
4

0 回答 0