调用Runtime.exec方法将产生一个本地的进程,并返回一个Process子类,问题:为什么Runtime.exec("ls"没有任何输出?)? 是什么原因?
{
process = Runtime.getRuntime().exec (command);
InputStreamReader ir=newInputStreamReader(process.getInputStream());
LineNumberReader input = new LineNumberReader (ir);
String line;
while ((line = input.readLine ()) != null)
System.out.println(line);
}
catch (java.io.IOException e){
System.err.println ("IOException " + e.getMessage());
}
|
|