如果我运行此代码,我在eclipse控制台上没有找到任何东西,但在终端中,程序SIPp运行正常
public class run {
public static void main(String[] args) throws IOException {
ProcessBuilder builder = new ProcessBuilder("sipp","-sn", "uas");
Map<String, String> environment = builder.environment();
Process javap = builder.start();
InputStreamReader tempReader = new InputStreamReader(new BufferedInputStream(javap.getInputStream()));
BufferedReader reader = new BufferedReader(tempReader);
while (true){
String line = reader.readLine();
if (line == null)
break;
System.out.println(line);
}
}
}
答案 0 :(得分:0)
按照以下
更改您的while循环String line;
BufferedReader reader = new BufferedReader(tempReader);
while ((line=reader.readLine()) != null){
System.out.println(line);
}
希望这会给你一个想法。