Java Program to find the IP address of the Machine

Wednesday, April 17th, 2013

Here is a simple Java Program to find the IP address of the Machine.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
import java.util.*;
import java.lang.*;
import java.net.*;
 
public class GetOwnIP
{
    public static void main(String args[]) {
        try{
            InetAddress ownIP=InetAddress.getLocalHost();
            System.out.println("IP of my system is := "+ownIP.getHostAddress());
        }catch (Exception e){
            System.out.println("Exception caught ="+e.getMessage());
        }
    }
}

Author Name :
Arun

Total : 1 Comment


One Response to “Java Program to find the IP address of the Machine”

  1. Code NIrvana says:

    Awesome Program!
    Man more such programs at : http://www.codenirvana.in/

Leave a Reply

Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup

Email: