黑马程序员技术交流社区

标题: 高人进,看清问题回答, [打印本页]

作者: 黑马-罗志强    时间: 2013-1-7 10:46
标题: 高人进,看清问题回答,
调用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());

        }  


作者: ying    时间: 2013-1-17 18:58
同学我想先问你个问题啊!你是用的是Windows操作系统呢?还是Linux啊操作系统?




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2