How to Set JVM Proxy Setting Without Touching the Code

1 comments

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:

  • 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
Commonly proxy servers are used for security reason, and those points above have to be implemented with a certain networking skills or by using some helper tools.

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]
Example:
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
For FTP, the arguments are:
  • ftp.proxyHost
  • ftp.proxyPort
  • ftp.nonProxyHosts
If the proxy network is a HTTP Proxy that requires authentication with username and password, then you have to use java.net.Authentication and it means that you have to touch your code.

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]
Example:
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

Simulation Game: Sim Tower

0 comments


So, last week I meet a friend and discovered that we were playing the same game on our childhood. I don't remember exactly when I started playing this game but I'm pretty sure that it was at elementary school because we played with Windows 3.1. At that time there was no Internet and my brother kind of copied the game from his friend who bought it from somewhere (maybe?). I had a nice childhood with computer especially computer games and I'm sure it also caused my eyesight problem.

It's quite fascinating when I tried to play again this game yesterday, my laptop's CPU clock is way too fast for the game, it's 100 times faster than the original speed. Consider that the game was built on 1994 at that time maybe CPU frequency was mere something above or under 32MHz I guess ? To play this game the CPU clock has to be turned down.

This game is quite simple compare to another simulation games like Sim City or Sim Town so I guess its target players are originally some younger kids. 2 years later they released a sequel of this game called Yoot Tower which was much improved than Sim Tower, but it's still ESA protected which means that it can't be downloaded legally.

For anyone who are interested here are the download links:
Sim Tower The Vertical Empire
Speedswitch XP