Skip to main content

Query Country Information from IP Address in Java

Language


This sample code show you how to get the country name from IP address. It requires the download of BIN database for the query. You can download it free at http://lite.ip2location.com.

I'm using the Eclipse for development. You will need to put them into src folder and link the JAR file. After all, you can run the testing. The sample BIN only contains partial record, therefore you may wan to download the full BIN database as the link given above

Note: This sample uses the jar file from IP2Location that will have random delays on the query for demo.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.