Hi Gentlemen,

I am working with a customer who has a host that doesn't have DNS configured. While trying to install one of our products, it used to fail at a point, when InetAddress was failing to return hostname and ip address of the localhost with UnknownHostException indication. nslookup won't work.!

The /etc/hosts has proper entries with the localhost defined along with its IP.

I have no clue where the InetAddress looks for to get the Ip and hostname. Any inputs where else it might look.?

The code snippet is as below:


import java.net.InetAddress;
public class logInetInfo
public static void main(String args[])
try {
InetAddress[] iaAll = InetAddress.getAllByName(InetAddress.getLocalHost( ).getHostName());
for (int i = 0; i < iaAll.length; i++) {
System.out.println ("Local Hostname : " + iaAll[i].getHostName().toLowerCase());
System.out.println ("Local IP Address : " + iaAll[i].getHostAddress());
} catch (Exception e) {


/etc/hosts file looks like this: localhost.localdomain localhost jerry

Any inuts where else i can look at would be very helpful..!