title: How to use automatic proxy configuration script in Java
body: <p>My Internet Explorer is set to have an automatic proxy file(so-called PAC) for web access.  Is there a way to use this on my Java program, also ?</p>
  
  <p>My below Java code does not seem to use proxy at all.</p>
  
  <pre><code>ArrayList&lt;Proxy&gt; ar = new ArrayList&lt;Proxy&gt;(ProxySelector.getDefault().select(new URI("http://service.myurlforproxy.com")));
  for(Proxy p : ar){
    System.out.println(p.toString()); //output is just DIRECT T.T it should be PROXY.
  }
  </code></pre>
  
  <p>I also set my proxy script on Java Control Panel(Control->Java), but the same result.
  and I found there's no way to set PAC file for Java programmatically.</p>
  
  <p>People use http.proxyHost for System.setProperties(..) but this is a only for setting proxy host, not proxy script(PAC file).</p>