UnknownHostException again!
I posted one question previously and all of them answered that there is some problem with DNS but i changed my DNS to many addressed and now i have the most reliable, google DNS :-
8.8.8.8
Still i get the same UnknownHostException. What can be the problem? This is my code :-
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse("http://rss.news.yahoo.com/rss/india");
Infact if i pass address as something very common like :- http://google.com i still ge开发者_如何转开发t the same error. Please help me :(. I have my submissions tomorrow.
Thanks in advance :)
EDIT : If i type the same address in my mozilla, it works great. So, i am sure that there is no DNS problem.
2nd EDIT :- I found this link http://www.ehow.com/how_4747553_fix-unknownhostexception-java-applications-ubuntu.html
But when i run the command
sudo apt-get install lib32nss-mdns
i get package not found.
Somebody even mentioned :-
-Djava.net.preferIPv4Stack=true
But where do i write this statement of Djava?
I am using Netbeans 6.8 to run my web application
Probably you need a proxy.
If so, try passing it in the command line
java -Dhttp.proxyHost=your.proxy.server -Dhttp.proxyPort=80 YourJavaApp
EDIT to set this information ( -Dhttp...etc etc ) in netbeans use the Run menu:
Run\Set Project Configuration\Customize\Run
Should look like this:
run http://img227.imageshack.us/img227/7903/netbeansy.png
Use the one that says: Virtual machine options and type:
-Dhttp.proxyHost=your.proxy.server -Dhttp.proxyPort=80
Or as per your update type:
-Djava.net.preferIPv4Stack=true
精彩评论