How to use OpenStreetMap in Java desktop application?

Hello forum,
I’m a newbie in geocoding.
Can u help me to understand how can I use OpenStreetMap in Java desktop application?

Thanks in advnced,

You can go to and type “java” at its search box there.

Or have a look at

I’m looking for a solution to the same problem although for different reasons.

I’m trying to display a usable map in a java desktop application but I’m struggling to work out how

Please tell us where and why you get struggling. And you should give us some information about your framework application so far.

I’m trying to develop a routing application for windows however I’m not sure how to load the maps in a usable format to display an image and design the route. I’ve built the user interface, I’m now trying to make it work.

any help or guidance would be much appreciated

Guys, I also have question regarding using of OSM in java app.
We’ve already used OSM in our app to provide our clients images with some locations.
Previously we had next mechanism:

  1. Searching for long. and lat. of object in GoogleMaps.
  2. We used url of OSM to generate image that has taken Long., Lat., image format(jpeg, png, etc), width, height, scale/(“” + loc.getLatitude() + “&long=” + loc.getLongitude() + “&z=” + scale + “&w=” + width + “&h=” + height + “&format=png”)

It was working excellent, but some months before OSM closed this URL and create new(“” + tileNumber + “.png”) that took parameters for location not in Long. and Lat. but in some tiles that are calculate using radians. After we started to adopted our solution for new service we found that formula for converting long and lat to radians isn’t very accurate. But most important reason is in quality of maps(we can’t specify size of tile) and problems with selecting scale.
As I understand new service was introduce to solve performance issues, but it doesn’t bring us what we had previously.

So my question, could we use some java framework or even external console windows application to generate image with location from coordinates in lat. and lon.?

AlexyPi - You could use JMapViewer to display the maps it’s available here -

Create a JFrame, and instance of the JMapViewer class found in the jar file and add it to the JFrame and you get a usable map with zoom and pan functions.

It also provides methods for setting the location and zoom level using lat and long. Therefore you could have a text box which the user types the location into, geocode it using google as you’ve done before, and the set the position using the mentioned function.

My only question is how are you getting around the Google Maps terms of service, which states that you cannot use their features with other maps here in section 10.1.1.g

I wanted to do exactly what I’ve said above but then I found that so now I do not think it’s allowed

Thank you Decor58 for advice. I’ve tried and integrated JMapViewer to my app. But after working with it and taking a look on it’s sources I have two quetions:

  1. Sometimes the whole map isn’t loaded and some tiles are missing. In console there is messages like “failed loading 3/3/3 Connection timed out: connect”. Is this possible to increase this timeout?
  2. Do you know a way to check if the whole map with all tiles is completely loaded? I tried to override a couple of methods but it didn’t help. I need this info to convert JMapViewer to image and save it in system.

I’m afraid I’ve not played around with the map that much so I cannot help, sorry