try {
Process q =Runtime.getRuntime().exec("netsh interface ip set addr \"本地连接 2\" static 192.168.32.3 255.255.255.0 192.168.32.1 1");
BufferedReader br = new BufferedReader(new InputStreamReader(q.getInputStream()));
    String line;
    while ((line = br.readLine()) != null){
     System.out.println(line);
    }
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}   
如果将这句话netsh interface ip set addr \"本地连接 2\" static 192.168.32.3 255.255.255.0 192.168.32.1 1写入批处理并以管理员身份运行的话确实可以修改系统的IP地址
但是当我以上面的代码的方式来修改IP的时候得到的提示是“请求的操作需要提升(作为管理员运行)。”
对于这样的问题该如何解决呢?还有就是为什么用Runtime运行某些cmd指令如pause,ipconfig等等的时候会报错,如下:
java.io.IOException: Cannot run program "ipconfig/renew": CreateProcess error=2, ?????????
求原因