Java Host Name Get getFullHostname()

Here you can find the source of getFullHostname()

Description

get Full Hostname

License

Apache License

Return

Full hostname of this machine.

Declaration

public static String getFullHostname() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.net.InetAddress;

public class Main {
    /**//from  w  w  w  . ja  v  a 2  s .c  om
     * @return Full hostname of this machine.
     */
    public static String getFullHostname() {
        // find the hostname
        String hostname = "unknown";
        try {
            final InetAddress host = InetAddress.getLocalHost();
            hostname = host.getHostName();
        } catch (Exception ignore) {
            // SWALLOWED
        }
        return hostname;
    }
}

Related

  1. getCanonicalHostName()
  2. getCasServerHostName()
  3. getCurrentHost()
  4. getDefaultHostName()
  5. getFile(String host, String savePath)
  6. getFullyQualifiedDomainName(String unqualifiedHostname)
  7. getFullyQualifiedHostName()
  8. getHost()
  9. getHost()