加上 |grep 参数就没有返回行了
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println( "a ");
String a = "env ";
/
try {
Runtime runtime=Runtime.getRuntime();
Process process=runtime.exec();
BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while((line=reader.readLine())!=null) {
System.out.println(line);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
------解决方案--------------------
看看有没有用。
http://blog.csdn.net/rainv/archive/2007/05/19/1616169.aspx