File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes InetAddress() not working in Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "InetAddress() not working in Linux" Watch "InetAddress() not working in Linux" New topic
Author

InetAddress() not working in Linux

Ramesh Jothimani
Ranch Hand

Joined: May 05, 2011
Posts: 70

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 :



Please suggest a solution for getting IP Address from domain name in cross platform.
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1035
    
  10

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

Joined: May 05, 2011
Posts: 70

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

Joined: Apr 29, 2011
Posts: 75

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: InetAddress() not working in Linux
 
Similar Threads
Learn your IP number and email it??
Read Client IP Address behind Proxy
IP Address Sniffer Log
how to get IP address in linux
InetAddress class