Java Host Name Get getHostName()

Here you can find the source of getHostName()

Description

get Host Name

License

Apache License

Declaration

@Deprecated
    public static String getHostName() 

Method Source Code


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

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

public class Main {
    @Deprecated
    public static String getHostName() {
        try {//w  w  w . ja  va  2s.  com
            InetAddress.getLocalHost().getHostName();
            return "0.0.0.0";
        } catch (UnknownHostException e) {
            e.printStackTrace();
            return "127.0.0.1";
        }
    }
}

Related

  1. getHostGateway()
  2. getHostInformation()
  3. getHostMac(String host)
  4. getHostName()
  5. getHostname()
  6. getHostName()
  7. getHostname()
  8. getHostName()
  9. getHostName()