Java Host Address Get getHostAddress()

Here you can find the source of getHostAddress()

Description

get Host Address

License

Open Source License

Declaration

public static String getHostAddress() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static String getHostAddress() {
        try {//from   w  ww .  ja v  a 2s. com
            return InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException uhe) {
            throw new Error("Couldn't get this host address, which is needed to register in the database");
        }
    }
}

Related

  1. getHost(final String address)
  2. getHostAddress()
  3. getHostAddress()
  4. getHostAddress()
  5. getHostAddress()
  6. getHostAddress()