可以使用 Runtime.getRuntime.exec("cmd /c ipconfig");
之后得到process得到输入流之类的得到屏幕信息或者使用InetAddress.getLocalHost..等试试C:\>ipconfigWindows 2000 IP ConfigurationEthernet adapter 本地连接: Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.0.44
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :PPP adapter Vnet_PPPoE: Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 202.105.96.191
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 202.105.96.191
之后得到process得到输入流之类的得到屏幕信息或者使用InetAddress.getLocalHost..等试试C:\>ipconfigWindows 2000 IP ConfigurationEthernet adapter 本地连接: Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.0.44
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :PPP adapter Vnet_PPPoE: Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 202.105.96.191
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 202.105.96.191
解决方案 »
- JDK1.6中的线程池的生命周期
- java中怎样解决double型数据小数位数的控制
- 一个小问题,请教大家~~
- (急急急)java执行linux命令的问题
- 一个超级变态的问题!!!解答下。。。
- 跪求,如何用AWT SWING开发图形界面
- 关于调用存储过程master..xp_cmdshell做文本文件导入到SQLServer的几个问题?!
- 这个问题好怪。
- 我是新手,我下载了eclipse,不知怎么编译?
- 请问,在Jbuilder8中运行时出现以下信息是什么原因?怎样解决?在线等待
- 关于Java中byte的问题,如何得到范围外字符的编码(我感觉有难度)
- 关于JbuilderX中中文显示问题如何解决?
try {
String ip = InetAddress.getLocalHost().getHostAddress().toString();
System.out.println(ip);
} catch (Exception e) {
e.printStackTrace();
}
}}
IPAddress = WS.LocalIP
MsgBox "Local IP = "+ IPAddress 这个一定行的