poyexinghun 发表于 2013-2-7 03:40:21

Java宽带连接

最近因项目需要不定时的更换IP,所有就下面的一段代码:
 
/** * 适用系统Windows */public class NetConnect{    public static void main(String[] args) throws Exception{      Process disconnect = Runtime.getRuntime().exec("rasdial.exe 宽带连接 /disconnect");      disconnect.waitFor();      System.out.println("宽带连接断开!");      Process connect = Runtime.getRuntime().exec("rasdial.exe 宽带连接 username password");      connect.waitFor();          System.out.println("宽带连接成功!");    }} 
页: [1]
查看完整版本: Java宽带连接