Java Local Host Get getLocalHostName()

Here you can find the source of getLocalHostName()

Description

get Local Host Name

License

Apache License

Declaration

public static String getLocalHostName() 

Method Source Code

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

import java.net.InetAddress;

import java.net.UnknownHostException;

public class Main {
    public static String getLocalHostName() {
        return getLocalHost().getHostName();
    }// ww w.  jav a  2  s . c o  m

    public static InetAddress getLocalHost() {
        try {
            return InetAddress.getLocalHost();
        } catch (final UnknownHostException e) {
            throw new IllegalStateException("Unable to obtain local host name");
        }
    }
}

Related

  1. getLocalHostName()
  2. getLocalHostName()
  3. getLocalHostName()
  4. getLocalHostName()
  5. GetLocalHostName()
  6. getLocalHostName()
  7. getLocalHostName()
  8. getLocalHostname()
  9. getLocalHostName()