12
I need to get the DNS address, for example "http://stackoverflow.com/questions/ask". I used the following code and able to get in the form of 192.X.X.X.
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
DirContext ictx = new InitialDirContext(env);
String dnsServers = (String) ictx.getEnvironment().get("java.naming.provider.url");
System.out.println("DNS Servers: " + dnsServers );