Java Host Name Get getHostName()

Here you can find the source of getHostName()

Description

get Host Name

License

Apache License

Declaration

public static String getHostName() 

Method Source Code

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

import java.net.InetAddress;

public class Main {
    public static String getHostName() {
        try {/*from ww  w  .  ja va 2  s.  c  o m*/
            return InetAddress.getLocalHost().getHostName();
        } catch (Exception e) {
            return null;
        }
    }
}

Related

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