• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

InetAddress() not working in Linux

 
Ramesh Jothimani
Ranch Hand
Posts: 70
Android Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have used the following line of code for getting IP Address from DNS Name.



It's working fine in windows environment . But when I use the same in Linux , I am getting the error as follows :

Exception :java.net.UnknownHostException


Please suggest a solution for getting IP Address from domain name in cross platform.
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following example works fine for me using Ubuntu 11.04 and 12.10 with JDK 1.7.0_09 .

It produces
bbc.co.uk bbc.co.uk/212.58.241.131
www.coderanch.com www.coderanch.com/64.78.181.5
www.google.com www.google.com/173.194.78.106
microsoft.com microsoft.com/65.55.58.201

You could check the Java bug database but it sounds to me like your network is not configured correctly.
 
Ramesh Jothimani
Ranch Hand
Posts: 70
Android Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Richard Tookey wrote:The following example works fine for me using Ubuntu 11.04 and 12.10 with JDK 1.7.0_09 .

It produces
bbc.co.uk bbc.co.uk/212.58.241.131
www.coderanch.com www.coderanch.com/64.78.181.5
www.google.com www.google.com/173.194.78.106
microsoft.com microsoft.com/65.55.58.201

You could check the Java bug database but it sounds to me like your network is not configured correctly.



Thanks for the reply . It's working in my Linux machine but in Unix I am getting same error .
 
K. Gil
Ranch Hand
Posts: 75
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's working in my Linux machine but in Unix I am getting same error .


is your unix box configured to use valid DNS servers? can you run host / dig or nslookup against these names from command line and find out if your system can resolve it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic