Java Host Name Get getHostName()

Here you can find the source of getHostName()

Description

get Host Name

License

GNU General Public License

Declaration

public static String getHostName() 

Method Source Code

//package com.java2s;
/*//from   w  w  w .ja  v  a2  s .  com
 Pulsar
 Copyright (C) 2013-2015 eBay Software Foundation
 Licensed under the GPL v2 license.  See LICENSE for full terms.
 */

public class Main {
    public static String getHostName() {
        String host = "unknownhost";
        try {
            host = java.net.InetAddress.getLocalHost().getHostName();
        } catch (java.net.UnknownHostException e) {

        }
        return host;
    }
}

Related

  1. getHostname()
  2. getHostName()
  3. getHostname()
  4. getHostName()
  5. getHostName()
  6. getHostname()
  7. getHostName()
  8. getHostName()
  9. getHostName()