I am using Ubuntu 64 bit and Java ignores the system DNS settings. How can I set these manually from within my Java program?
Here is the code (sorry the JVM language is Clojure):
(clojure.contrib.http.agent/string (clojure.contrib.http.agent/http-agent (str "http://yahoo.com")))
:which results in:
java.net.UnknownHostException: yahoo.com
Other people have had similar problems: Java cannot resolve DNS address from AIX: UnknownHostException
**nslookup yahoo.com**
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: yahoo.com
Address: 69.147.125.65
Name: yahoo.com
Address: 72.30.2.43
Name: yahoo.com
Address: 98.137.149.56
Name: yahoo.com
开发者_JS百科Address: 209.191.122.70
Name: yahoo.com
Address: 67.195.160.76
In the end I found the answer to my problem at:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477211
lib32nss-mdsn needs to be installed on Ubuntu to make this work
精彩评论