Java Host Name Get getFullyQualifiedHostName()

Here you can find the source of getFullyQualifiedHostName()

Description

get Fully Qualified Host Name

License

Open Source License

Declaration

public static String getFullyQualifiedHostName() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.InetAddress;

import java.net.UnknownHostException;

public class Main {
    public static String getFullyQualifiedHostName() {

        String localhost = null;//from  w  w w.j  a v  a  2  s .  c  o m
        try {
            localhost = InetAddress.getLocalHost().getCanonicalHostName().toLowerCase();
        } catch (UnknownHostException e) {
            e.printStackTrace();
            localhost = "Unknown Host";
        }
        return localhost;
    }
}

Related

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