Chinaunix

标题: 获取网卡MAC地址 [打印本页]

作者: sunwei0325    时间: 2008-07-30 11:18
标题: 获取网卡MAC地址
    /**
    * 获取网卡MAC地址
    */
    public static String getMacOnWindow() {
        try {
            String mac = null;
            Process process = Runtime.getRuntime().exec("ipconfig /all");
            BufferedReader buffer =
            new BufferedReader(new InputStreamReader(process.getInputStream()));
            for (String line = buffer.readLine(); line != null; line = buffer.readLine()) {
            int index = line.indexOf("Physical Address");
                if (index

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/59737/showart_1096737.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2