Wednesday, December 08, 2004

Connect through a Proxy before Java 1.5

Just realized that it was more complicated to connect through a proxy before java 1.5. Here is the link: http://www.rgagnon.com/javadetails/java-0085.html

Connect through a Proxy
You have to set the following properties :

proxySet, proxyHost and proxyPort.

This can be done when starting the JVM for a JAVA application from the command line:

java -DproxySet=true -DproxyHost=myProxyServer.come -DproxyPort=80 MyJavaApp

Or in your source :

import java.util.Properties;
...

Properties systemSettings = System.getProperties();
systemSettings.put("http.proxyHost","myProxyServer.com") ;
systemSettings.put("http.proxyPort", "80") ;

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home