请问在java里怎样获取IE的代理设置,然后又利用该设置来读取url数据

解决方案 »

  1.   

    只知道设置代理在你读取URL数据的代码前面加上:
                System.getProperties().put("proxySet","true");
                System.getProperties().setProperty( "http.proxyHost","RDPROXY");
                System.getProperties().setProperty( "http.proxyPort","80");
    其中http.proxyHost http.proxyPort分别换成自己的代理地址和端口
      

  2.   

    try{
                System.getProperties().put("proxySet","true");
                System.getProperties().setProperty( "http.proxyHost","你自己的代理地址");
                System.getProperties().setProperty( "http.proxyPort","你自己的代理端口");
                URL url = new URL("http://163.com");
                BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                String str;
                while ((str = in.readLine()) != null) {
                    System.out.println(str);
                }
                in.close();
    }catch(Exception e){
        e.printStackTrace();
    }
      

  3.   

    If you are runing Applet, you can try ProxySelector, a class in 
    JDK 5.0. You can also use this class in Java App, but the proxy info 
    returned is what you pass on command line, such as -Dhttp.proxyHost=..