可以使用 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

解决方案 »

  1.   

    String hostname= InetAddress.getLocalHost().getHostName()
      

  2.   

    import java.net.*;public class Test {   public static void main(String[] args) {
          try {
             String ip = InetAddress.getLocalHost().getHostAddress().toString();
             System.out.println(ip);
          } catch (Exception e) {
             e.printStackTrace();
          }
       }}
      

  3.   

    用InetAddress.getLocalHost().getHostAddress()应该行,如果真的不行可以用vbsctipt取了,再通过rquest传给server.Set WS = CreateObject("MSWinsock.Winsock") 
    IPAddress = WS.LocalIP 
    MsgBox "Local IP = "+ IPAddress 这个一定行的