怎样获得本地的子网掩码、DNS和网卡信息? 在DOS命令窗口用:IPCONFIG/ALL 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以调用os的系统命令,捕获输出来分析出DNS,MAC等等。 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结果的字符串你自己处理吧。 java报表柱形图的问题 求助!!! 简单数组问题 怎样获得本机的ip地址啊!! 运行JAR程序上的问题 请问一个关于list的问题 郁闷中。关于JPanel问题。 编译java程序的问题,很奇怪的问题 菜鸟求助,做一个点击button自己播放本地mid文件的程序,运行出错 请问:在Jbuilder4.0中,APPLET怎样访问数据库(以ACCESS为例)? JCreator 如何配置jdbc 怎样将字符串转化为整数?急
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结果的字符串你自己处理吧。