Java Host Name Get getShortHostName()

Here you can find the source of getShortHostName()

Description

get the current host name

License

Apache License

Return

String host name

Declaration

public static String getShortHostName() 

Method Source Code


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

import java.net.InetAddress;
import java.net.UnknownHostException;

public class Main {
    /**/* w  ww  .  j a v a  2  s  . c  o m*/
     * get the current host name
     * 
     * @return String host name
     */
    public static String getShortHostName() {

        String hostname = null;
        try {
            hostname = InetAddress.getLocalHost().getHostName();
        } catch (UnknownHostException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return hostname;
    }
}

Related

  1. getMyHostname()
  2. getProxy(String host, String proxyType)
  3. getServerHost()
  4. getShortHostname()
  5. getShortHostName()
  6. getShortHostname()
  7. getTimerServerHost()