注册 登录
编程论坛 J2EE论坛

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

candy110 发布于 2008-09-25 13:00, 1908 次点击
哪位大侠能帮下忙啊,用java怎样写出一个修改IP的程序,谢谢!!!
2 回复
#2
卜酷塔2008-09-25 17:02
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!");   
  }   
  }
#3
candy1102008-09-25 17:26
谢谢版主
1