How to use map matching in eclipse?

If I want to use map matching, do I have to build a new maven project? Or other type of project is also okay? I’m new to maven project.

I created a dynamic web project. And I downloaded jars from mvn-graphhopper and mvn-map-matching. I added them in build path config. I imported com.graphhopper in a java file and the main code is from github-map-matching-java-usage. No mistake. But when i run it, error happened:
Exception in thread “main” java.lang.NoClassDefFoundError: gnu/trove/list/TIntList

I don’t know what to do. And I don’t know whether I should work with a new maven project or sth else.

Thanks for answering.

If you’re going to work with jars then you’ll need to add also all GraphHopper jar dependencies, e.g. Trove, etc.

Better include GraphHopper modules via Maven like in their guides (here and here), so that dependencies can be resolved automatically.

Regarding Eclipse usage you can check GraphHopper guide here.

added trove jar. new error:
Exception in thread “main” java.lang.UnsupportedOperationException: Cannot create DataReader. Solutions: avoid import via calling load directly, provide a DataReader or use e.g. GraphHopperOSM or a different subclass
at com.graphhopper.GraphHopper.createReader(GraphHopper.java:717)
at com.graphhopper.GraphHopper.importData(GraphHopper.java:710)
at com.graphhopper.GraphHopper.process(GraphHopper.java:681)
at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:659)
at Test2.main(Test2.java:32)

Test2.java:32 is:
hopper.importOrLoad();

How to solve it?

New to maven project. Want to try it later.

I get the same error when I use the 0.8.2 version. Is there a fix already?

@devemux86 I think I figured out what the problem was. From version 0.7.0 to 0.8.x was a medium change on the api and the structure of the project (on how the jars will be created and named)

So with the version 0.8.x one has to use the GraphHopperOSM class to import osm maps or one will receive the exception above. In the 0.7.0 version and below the GraphHopper class was sufficient. However, to use the GraphHopperOSM class one has to import additionally the following maven dependency.

com.graphhopper
graphhopper-reader-osm
0.8.2

This is necessary because from the version 0.8.x the project was split into different jars and no complete jar (as far as I can see) will be built anymore in the map-matching project. (I also pulled the project from github and built the project but the result was the same) So the maven dependency which is given in the example here is invalid at the moment and one has to use this dependency to get the java example working:

com.graphhopper
graphhopper-map-matching-core
0.8.2

Am I right so far or did I miss something? A little reply on this post would be nice.

Best regards,

Julian

@karussell the documentation needs an update for the Maven declaration?

Have done it here or did you mean something else?

I think above they mean for 0.8 branch?

Indeeed, I meant the 0.8 branch.