Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I use this snippet of Java code to lookup an IP Address from the domain name

InetAddress address = InetAddress.getByName("google.com");

It works fine in Windows & Linux but throws java.net.UnknownHostException in Unix.

For nslookup google.com, I am getting "No address information is available" in console. How can I resolve it ?

share|improve this question

closed as off topic by voretaq7 Feb 13 '13 at 17:49

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Verify that DNS resolution is working properly first. As your netstat output suggests, it's not. Which Unix are you talking about? –  fuero Feb 13 '13 at 17:28
    
You have an answer below, but this question is really off-topic for Server Fault - per the FAQ all questions here are supposed to relate to professional system administration in some way - there's no indication from your question that this question is related to professional system administration, and while we don't discourage basic questions this one is a little below the minimum barrier to entry... –  voretaq7 Feb 13 '13 at 17:52

1 Answer 1

If your server has Internet connectivity, you will need to add a nameserver in your /etc/resolv.conf file

       nameserver 8.8.8.8

You can also replace 8.8.8.8 with our own dns server, if you have any.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.