当前位置: 代码迷 >> Java Web开发 >> 如何用java写一个修改本机IP的小程序!!!
  详细解决方案

如何用java写一个修改本机IP的小程序!!!

热度:161   发布时间:2008-09-25 13:00:32.0
如何用java写一个修改本机IP的小程序!!!
哪位大侠能帮下忙啊,用java怎样写出一个修改IP的程序,谢谢!!!
搜索更多相关主题的帖子: java  IP  

----------------解决方案--------------------------------------------------------
public   class   Execute   
  {   
  private   static   void   setIP(String   newip)   throws   Exception   
  {   
  Runtime.getRuntime().exec("netsh   interface   ip   set   addr   \"本地连接\"   static   "+newip+"   255.255.255.0   192.168.32.1   1");   
  }   
   
  public   static   void   main(String[]   args)   throws   Exception   
  {   
  System.out.println("Begin   to   set   the   local   ip   address\nPlease   wait...");   
  System.out.println("\nAfter   setting   the   ip,   the   program   will   auto   exit...");   
  setIP("192.168.32.100");   
  System.out.println("Set   ip   successful!");   
  }   
  }

----------------解决方案--------------------------------------------------------
谢谢版主
----------------解决方案--------------------------------------------------------
  相关解决方案