How to set proxy settings for JVM
You can configure proxy settings in JVM using 2 VM arguments. Those are
Dhttp.proxyPort
Dhttp.proxyHost
As these are proxy arguments, while running a Java program from command line or from eclipse, you need to provide these arguments to Java.
The sample code is given below.
"C:\Program Files\Java\jrockit-jdk1.6.0_45-R28.2.7-4.1.0\bin\java" -Dhttp.proxyPort=80 -Dhttp.proxyHost=www-proxy.us.xxxx.com -jar "C:\Program Files\Java\jrockit-jdk1.6.0_45-R28.2.7-4.1.0\missioncontrol\mc.jar"
Here i am trying to run mc.jar by setting proxy port and proxy host arguments.
If you want to set proxy settings in eclipse, you can refer below screenshot. for running HttpURLConnectionExample, i am setting proxy vm arguments.
Dhttp.proxyPort
Dhttp.proxyHost
As these are proxy arguments, while running a Java program from command line or from eclipse, you need to provide these arguments to Java.
The sample code is given below.
"C:\Program Files\Java\jrockit-jdk1.6.0_45-R28.2.7-4.1.0\bin\java" -Dhttp.proxyPort=80 -Dhttp.proxyHost=www-proxy.us.xxxx.com -jar "C:\Program Files\Java\jrockit-jdk1.6.0_45-R28.2.7-4.1.0\missioncontrol\mc.jar"
Here i am trying to run mc.jar by setting proxy port and proxy host arguments.
If you want to set proxy settings in eclipse, you can refer below screenshot. for running HttpURLConnectionExample, i am setting proxy vm arguments.
Comments
Post a Comment