在DOS命令窗口用:
IPCONFIG/ALL

解决方案 »

  1.   

    可以调用os的系统命令,捕获输出来分析出DNS,MAC等等。
      

  2.   

    package test;import java.io.*;public class Untitled1 {
        public Untitled1() {
        }    public static void main(String[] args) {
    Untitled1 untitled11 = new Untitled1();
    try {
        Process s = Runtime.getRuntime().exec(
    "c:\\winnt\\system32\\ipconfig.exe /all");     InputStreamReader ir = new InputStreamReader(s.getInputStream());     LineNumberReader input = new LineNumberReader(ir);     String line;     while ( (line = input.readLine()) != null) { System.out.println("message is --------------------" + line);     }
    }
    catch (IOException ex) {
        System.out.print(ex.getMessage());
    }
        }
    }
    输出结果:
    Windows 2000 IP Configuration Host Name . . . . . . . . . . . . : xindi30 Primary DNS Suffix  . . . . . . . : rkk.com Node Type . . . . . . . . . . . . : Broadcast IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : rkk.comEthernet adapter ローカル エリア接続: Connection-specific DNS Suffix  . :  Description . . . . . . . . . . . : VIA PCI 10/100Mb Fast Ethernet Adapter Physical Address. . . . . . . . . : 00-05-5D-65-64-28 DHCP Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 172.16.113.66 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 172.16.113.105 DNS Servers . . . . . . . . . . . : 172.16.113.105                                     172.16.113.105结果的字符串你自己处理吧。