title: How to configure the DNS server java should use in jdk 9, 10 and 11
body: <p>For testing we have a DNS server that will respond with dummy records. Previously we could make java use our DNS server (here it is just using local host) by using:</p>
  
  <pre><code>"-Dsun.net.spi.nameservice.nameservers=127.0.0.1",
  "-Dsun.net.spi.nameservice.provider.1=dns,sun",
  </code></pre>
  
  <p>This no longer works under jdk11. 
  Is it possible to specify the DNS server to use under jdk11? If so how?</p>
  
  <p>Edit:
  I also attempted:</p>
  
  <pre><code>-Djava.naming.provider.url=dns://127.0.0.1
  </code></pre>
  
  <p>from <a href="https://github.com/AdoptOpenJDK/openjdk-jdk11/blob/master/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContextFactory.java" rel="noreferrer">https://github.com/AdoptOpenJDK/openjdk-jdk11/blob/master/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContextFactory.java</a> but that did not work either.</p>