[Advanced-java] setting http proxy for use by ALL java vm applications

Frank D. Greco fgreco at CrossroadsTech.com
Wed Jul 2 07:25:39 2003


At 12:34 AM 5/17/2003 -0500, Hanasaki JiJi wrote:
>is there a way to setup the java environment so that all applications will 
>implicitly use a http proxy?

         Alter your PATH so that a different "java" is called (ie, move
         the target directory earlier in the PATH)... perhaps
         a shell script, .bat file or perl thing that calls the 'real'
         java with the appropriate command line args.

>basically the effect of -Dhttp.proxyHost=myFirewall
>
>but in a way that:
>         java com.MyMain
>will use the proxy?
>
>The reason for this is because some applications have big custom scripts 
>or .exe loaders and I can modify the startup scripts.

         We have startup code in all our Java apps that reads
         a global properties file, then reads a local properties file
         for override settings.

         You can also set your defaults for proxy use like this:

System.setProperty("http.proxySet", System.getProperty("http.proxySet", 
"true"));
System.setProperty("http.proxyHost", System.getProperty("http.proxyHost", 
"myFirewall"));
System.setProperty("http.proxyPort", System.getProperty("http.proxyPort", 
"12345"));

         Frank G.