0

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 get 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

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

1 Comment

Can you just tell me where should i write this line -Djava.net.preferIPv4Stack=true in Netbeans?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.