title: Choose DNS server for resolving hostnames in Java
body: <p>resolving a hostname to an IP address is rather easy in Java by using the <em>InetAddress</em> class like this:</p>
  
  <pre><code>InetAddress address = InetAddress.getByName("www.example.com");
  </code></pre>
  
  <p>But this method uses the DNS server which is used by the running system.</p>
  
  <p>Is there any way to specify the DNS server that should be used for resolving?</p>