How do I configure proxy settings for Java in Solaris to handle Proxy Auto Config (PAC) scripts?

前端 未结 2 807
轻奢々
轻奢々 2021-01-06 16:05

I would like to configure Java proxy settings on Solaris to use a Proxy Auto Config (PAC) scriptt.

I have found instructions for making the settin

相关标签:
2条回答
  • 2021-01-06 16:34

    The article you have provided is about the the Java Plug-in (i.e. the Java runtime environment for browsers) that can be configured through the Java Plug-in Control Panel and applies to:

    Platform(s): All Platforms

    So, it's really not Windows specific.

    Now, if your question is "How do I start the Java Plug-in Control Panel on Solaris", the answer is:

    You can run the Control Panel by launching the ControlPanel executable file. In the Java 2 SDK, this file is located at

    <SDK installation directory>/jre/bin/ControlPanel
    

    For example if your Java 2 SDK is installed at /usr/j2se, launch the Control Panel with this command:

    /usr/j2se/jre/bin/ControlPanel 
    

    But usually people are not using Solaris for surfing so I'm not really sure that this is what you're looking for (actually, I didn't understand clearly what you want to do).

    If you are going to connect programmatically, please note that Java uses two system properties to designate a proxy: http.proxyHost and http.proxyPort. For applets, these are automatically set to use the browser's settings. However, in an application you need to set them yourself:

    Properties props = System.getProperties();
    props.put("http.proxyHost", "proxyhostname");
    props.put("http.proxyPort", "proxyhostport");
    

    As per comment, my understanding is that you want to use a PAC file. To use a Proxy auto-config from Java code and/or Ant with Java 1.5+, you can configure the proxy at the "OS level" and set the system property java.net.useSystemProxies to true (see section 4) ProxySelector of Java Networking and Proxies) or the -autoproxy option for Ant. This will make the Java code and/or Ant use the OS proxies.

    To setup your Solaris host, if you are using Gnome 2.X, you can configure proxies globally through the user interface (System > Preferences > Network Proxy). If you're not using Gnome, setup the following environment variable:

    export http_proxy=http://username:password@proxy_url
    

    To specify a list of non proxy hosts (if necessary), setup this variable (this is an example):

    export no_proxy=localhost,127.0.0.0/8,*.local
    
    0 讨论(0)
  • 2021-01-06 16:37

    Sadly the system proxy selector does not handle PAC/WPAD/JS specifications, confirmed by my testing with Windows or MacOS X. Even on Java6, which includes a JavaScript interpreter.

    I'm hoping proxy-vole http://code.google.com/p/proxy-vole/ may do the trick.

    0 讨论(0)
提交回复
热议问题