Class InetAddressUtil

  • public class InetAddressUtil
    extends Object
    • Constructor Detail

      • InetAddressUtil

        public InetAddressUtil()
    • Method Detail

      • getLocalHostName

        public static String getLocalHostName()
                                       throws UnknownHostException
        When using the InetAddress.getHostName() method in an environment where neither a proper DNS lookup nor an /etc/hosts entry exists for a given host, the following exception will be thrown: <hostname>: <hostname> at ... Instead of just throwing an UnknownHostException and giving up, this method grabs a suitable hostname from the exception and prevents the exception from being thrown. If a suitable hostname cannot be acquired from the exception, only then is the UnknownHostException thrown.
        The hostname