mkgmap - ClassNotFoundException: Long2ObjectOpenHashMap

Hi,

I’m just figuring out how to create garmin maps from the wiki docs. I exported a small osm file using JOSM and then attempted to run mkgmap as suggested below and got the listed exception. I tried adding and removing several options even down to just gmapsupp and the file. In all cases I got the exception listed.

I had to install java to do this so have the latest version (java version “1.8.0_25”). I don’t have to install java 1.7 I hope…

Has anybody seen this error or can see an error with the command? I cannot seem to get around this. I tried running versions back to 3354 of mkgmap and get the same result.

Many thanks for any help.
Blair

C:\Blair\OSM\Maps>java -jar mkgmap-3392.jar --route --add-pois-to-areas --bounds=bounds --index --gmapsupp GowlandTodd.osm

Time started: Fri Jan 02 15:13:17 PST 2015
java.lang.NoClassDefFoundError: it/unimi/dsi/fastutil/longs/Long2ObjectOpenHashMap
        at uk.me.parabola.mkgmap.reader.osm.OSMId2ObjectMap.<init>(OSMId2ObjectMap.java:38)
        at uk.me.parabola.mkgmap.reader.osm.ElementSaver.<init>(ElementSaver.java:49)
        at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.createElementSaver(OsmMapDataSource.java:170)
        at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.setupHandler(OsmMapDataSource.java:152)
        at uk.me.parabola.mkgmap.reader.osm.xml.Osm5MapDataSource.load(Osm5MapDataSource.java:59)
        at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.load(OsmMapDataSource.java:127)
        at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:167)
        at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:63)
        at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:253)
        at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:249)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 14 more
Exiting - if you want to carry on regardless, use the --keep-going option
Number of ExitExceptions: 1
Time finished: Fri Jan 02 15:13:18 PST 2015
Total time taken: 235ms

The fastutil-6.5.15-mkg.1b.jar is missing in your classpath.
The file mkgmap-3392.jar is not in the mkgmap download so it looks like that you compile mkgmap yourself? In such a case please ensure that the jar files osmpbf-1.3.3.jar, protobuf-java-2.5.0.jar and fastutil-6.5.15-mkg.1b.jar are in your classpath.

WanMil,

Thanks for your reply. The mkgmap-3392.jar was just renamed from that which came with the download. When I tried the older version I needed to distinguish the two.

I didn’t explicitly set the classpath, I just copied the jar file to the directory with the osm and ran it from there which looks like where the problem was. I looked into the lib directory and saw the jar files you mentioned so I just copied lib to the same directory with the .osm and mkgmap.jar files and it worked.

Thanks again for your reply,
Blair