How to Set JVM Proxy Setting Without Touching the Code
First of all, proxy server is a server that acts as an intermediary for requests from clients seeking resources from other server (or Internet). Usually companies' Internet connection facility use proxy to make it possible to control their employees' browsing activities, such as:
By adding these 3 JVM arguments to java, your application will use the proxy network to create HTTP requests:
java -Dhttp.useProxy=true -Dhttp.proxyHost=10.1.1.2 -Dhttp.proxyPort=8877 -Dhttp.nonProxyHosts=127.0.0.1|localhost -jar testsomething.jar
For HTTPS, the arguments are:
If the proxy network is a SOCKS v5 Proxy, then again it can be done by using JVM arguments:
java -DsocksProxyHost=10.1.1.2 -DsocksProxyPort=8877 -Djava.net.socks.username=alibaba -Djava.net.socks.password=secret
For further information:
Networking Properties reference from sun.java.com
Java Networking and Proxies from sun.java.com
- Define someone's bandwidth limit for a specific period
- Define a blacklist of websites, within a specific time schedule or not
- Storing employees' browsing history log
- Storing employees' chatting history log
By adding these 3 JVM arguments to java, your application will use the proxy network to create HTTP requests:
- http.useProxy=true
- http.proxyHost=[domain or IP]
- http.proxyPort=[port number]
- http.nonProxyHosts=[regex of proxy exclusions]
java -Dhttp.useProxy=true -Dhttp.proxyHost=10.1.1.2 -Dhttp.proxyPort=8877 -Dhttp.nonProxyHosts=127.0.0.1|localhost -jar testsomething.jar
For HTTPS, the arguments are:
- https.proxyHost
- https.proxyPort
- http.nonProxyHosts
- ftp.proxyHost
- ftp.proxyPort
- ftp.nonProxyHosts
If the proxy network is a SOCKS v5 Proxy, then again it can be done by using JVM arguments:
- socksProxyHost=[domain or IP]
- socksProxyPort=[port number]
- java.net.socks.username=[the username]
- java.net.socks.password=[the password]
java -DsocksProxyHost=10.1.1.2 -DsocksProxyPort=8877 -Djava.net.socks.username=alibaba -Djava.net.socks.password=secret
For further information:
Networking Properties reference from sun.java.com
Java Networking and Proxies from sun.java.com

Comments
Saved my day too.
check out the RangeXTD Reviews
the Best Wifi Booster
SoundPRO Sport Wireless Earphone Review
NanoSecure Review
Handsan Wrist Wearable Hand Sanitizer