Search code examples
javageolocation

How to get location details from IP address integer value


I am converting IP address in to its corresponding number. Now I want to know the location details i.e. long and lat, time zone etc. Is it possible in Java. Do i have to use some external jar for database ?


Solution

  • IP addresses themselves don't have location info. However a number of databases/services exist that have this mapping.

    See this blog entry for a number of different options. There are a number of APIs and databases to connect to for this, and you have the option of downloading such info locally to avoid remote lookups.