在java中的exec()方法中重定向

时间:2013-10-03 11:56:05

标签: java linux redirect exec

我得不到合适的答案.. 我的代码是

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$ 

0 个答案:

没有答案