How to Get Client IP Address Using Java Code

/*
 * @author :Anand
 */

package com.anand;

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

public class IP{

public static void main(String[] args) {
 
 InetAddress ip;
 try {
 
ip = InetAddress.getLocalHost();
System.out.println("Your IP is====>" + ip.getHostAddress());
 
 } catch (UnknownHostException e) {
 System.out.println("catch the exception if Error Come ===>"+e);
 
e.printStackTrace();
 
 }
 
}
 
}

Comments

Popular posts from this blog

Converting JSONArray into CSV file in java

Online Book Store Website Using Java

How to read CSV File in Java