java.lang.Process proc = Runtime.getRuntime().exec("ifconfig");

解决方案 »

  1.   

    try {
                java.lang.Process myproc = Runtime.getRuntime().exec("ifconfig");
                InputStream is = myproc.getInputStream();
                byte[] data = new byte[1024*2];
                int i = 0;
                is.read(data,0,1024*2);
                System.out.println(new String(data));
                is.close();
                is = null;
            } catch (IOException e) {
                e.printStackTrace();
            }