所以这是我的代码:
System.out.print("hellow");
try {
int x;
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("java CPU/memory");
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while((line = in.readLine())!=null) {
System.out.println(line);
}
proc.waitFor();
} catch (Throwable t)
{
t.printStackTrace();
}
$
当我在 cmd 中运行 java CPU/CPU 时,我得到退出值为 0 的“hellowhello”
但是当我在 Eclipse 中运行它时,我只会得到退出值为 1 的“hello”
任何的想法?