源代码
Process pro;
try {
//用Java编写应用时,有时需要在程序中调用另一个现成的可执行程序或系统命令,这时可以通过组合使用Java提供的Runtime类和Process类的方法实现。
pro = Runtime.getRuntime().exec(commandBuidler.toString());
System.out.println(pro==null);
System.out.println(pro.getInputStream()+"#");
BufferedReader buffer=new BufferedReader(new InputStreamReader(pro.getInputStream()));
System.out.println(buffer+"%");
System.out.println(buffer==null);
String str = buffer.readLine();
System.out.println(buffer.readLine()+"&");
System.out.println(buffer.readLine()==null);
System.out.println(str+"*");
while(null!=str){
str = buffer.readLine();
if(null==str){
pro.destroy();
}
}
buffer.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return "false";
}
运行的结果如下

bufferedreader不等于null,不一定读出来的结果就不为null.
要确保你读取的文件中有内容啊。
怎么看读取的文件是否有内容啊
/**
* Reads a line of text. A line is considered to be terminated by any one
* of a line feed ('\n'), a carriage return ('\r'), or a carriage return
* followed immediately by a linefeed.
*
* @return A String containing the contents of the line, not including
* any line-termination characters, or null if the end of the
* stream has been reached
*
* @exception IOException If an I/O error occurs
*/
public String readLine() throws IOException {
return readLine(false);
}
以上代码了来自 jdk的实现,很明显,readLine()返回null 就证明 流中 没有数据呗