Find Public IP Address in Java

By | March 1, 2016
 

Find Public IP Address in Java Programming

Here, we have posted a Simple Program that describes How To Find Public IP Address in Java Programming that you’re currently logged in. This Java Program is an IP Address Tracker Program wherein you can get the Public IP Address of your Machine only when you connect your System to the Internet.

What is an IP Address?

IP  stands for Internet Protocol Address. It is a 32-Bit Address String. It is a Numerical Tag associated with every Electronic Device such as Mobile Phone, Laptop, Desktop, Printer, Router, etc that helps to identify every single device connected to a Network. It is primarily used for Communication with different devices connected on the same Network.

How Does This Program Works?

This Program makes use of InetAddress Class to get the Public IP Address of your machine via WhatIsMyAdddress.com. However, this Program works only when your System is connected to the Internet. It gives an Error when Internet is not connected which we have handled through Exception.

Find Public IP Address in Java Programming Language

 

Output

Find Public IP Address in Java Programming Language

We hope that you got a basic information about How To Find Public IP Address in Java Programming Language. In case you get any Compilation Errors with this Java Program To Check Public IP Address or you have any doubt about it, let us know about it in the Comment Section below.

Recommended Programs
Find Local Host IP Address in Java Programming Language
Execute Linux gEdit Text Editor with Java Program
Java Program To Convert Numbers into Words
Print Map of India in Java Programming
100+ Java Programs

6 thoughts on “Find Public IP Address in Java

    1. Tushar Soni Post author

      Thank you Shanmukha! We hope you stay connected with us and find some excellent C Programs on our website!

      Reply
  1. basil raj

    thank very hopefully this program bro.. but i want to automatically alert ip address .how to find that profram ..please tell that progrma

    Reply
  2. PRIYANKA

    nice platform.. plz tell me about cryptography as well as hacking concept.

    Reply
  3. Jeevitha

    Hi,
    nice program.
    but i have a doubt. in my project i have an api url which used this piece of code to get public ip of a machine and that is running on lets say server A. And that api url is placed inside a separate web page which is running on server B. Now my question is… if I load the web page from different locations and different machines what will be the output of public ip?
    my actual output: I am getting the public ip of server B where the web page is running.
    expected output: i need to get the public ip of the particular machine on which the web page is loaded.
    can anyone pls clarify it to me?
    Thanks

    Reply

Let's Discuss