public class test { /**
 * @param args
 */
public static void main(String[] args) {
// TODO Auto-generated method stub
Runtime rn = Runtime.getRuntime();
Process p = null;
try {
p = rn.exec("cmd /k dir");
InputStream in =p.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String str = null;
while((str = br.readLine()) != null){
System.out.println(str);
}
br.close();
} catch (Exception e) {
System.out.println("Error exec notepad");
}
}
}
在readLine的时候程序最后会死掉,不知道怎么回事,怎么才能改掉呢?