title: How to set a custom DNS server with Java 8 and Open-JDK?
body: <p>How to set a custom DNS server with Java 8 and Open-JDK to resolves hostnames? I tried the following from the other stackoverflow post but it doesn't seem to work for open-jdk-8. any ideas?</p>
  
  <pre><code> System.setProperty("sun.net.spi.nameservice.nameservers", "100.68.0.50");
   System.setProperty("sun.net.spi.nameservice.provider.1", "dns,sun");
  </code></pre>
  
  <p><code>100.68.0.50</code> is my dns-server</p>