Recently I was in the position of having to override the system default DNS server configuration with a custom DNS server for a Java app. Expecting this to be easily achievable along the line of the well-known http.proxyHost/http.proxyPort JVM parameters I whipped out Google.
Turned out to not to be so simple.
Obviously I got some search hits, but no simple recipe for the simple configuration change I was looking for. After spending some time with the leads I was able to conclude that, as a consequence of an apparent exemple of over-engineering by Sun, the following is explicitly required just to change the JVM DNS server:
//Override system DNS setting with Google free DNS server System.setProperty("sun.net.spi.nameservice.nameservers", "188.8.131.52"); System.setProperty("sun.net.spi.nameservice.provider.1", "dns,sun");