Java IP Address Get getLocalIp()

Here you can find the source of getLocalIp()

Description

Get local IP

License

Apache License

Exception

Parameter Description
UnknownHostException an exception

Declaration

public static String getLocalIp() throws UnknownHostException 

Method Source Code


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

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

public class Main {
    /**//from  www  .  ja  va  2  s.  c  o m
     * Get local IP
     * 
     * @return
     * @throws UnknownHostException
     */
    public static String getLocalIp() throws UnknownHostException {
        String ip = InetAddress.getLocalHost().getHostAddress();
        return ip;
    }
}

Related

  1. getLocalIP()
  2. getLocalIP()
  3. getLocalIp()
  4. getLocalIp()
  5. getLocalIP()
  6. getLocalIP()
  7. getLocalIP()
  8. getLocalIp()
  9. getLocalIP()