0
我使用運行shell腳本:Java不打印出來外殼呼應
Runtime.getRuntime().exec(command);
一切正常,exept爲輸出。所以,這個腳本
echo "opening gedit..."
gedit
打開gedit,但是當從Java運行我沒有得到任何輸出。問題是什麼?
我使用運行shell腳本:Java不打印出來外殼呼應
Runtime.getRuntime().exec(command);
一切正常,exept爲輸出。所以,這個腳本
echo "opening gedit..."
gedit
打開gedit,但是當從Java運行我沒有得到任何輸出。問題是什麼?
String line;
Process p = Runtime.getRuntime().exec(...);
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close();
你在哪裏希望看到的輸出,爲什麼提到? – 2014-09-27 17:03:30
[打印運行時exec()OutputStream到控制檯]可能的重複(http://stackoverflow.com/questions/3936023/printing-runtime-exec-outputstream-to-console) – 2014-09-27 17:06:12