NoClassDefFoundError when trying to load graphhopper from external project

To start, I’m a bit new to Java and graphhopper. We’re trying to use graphhopper as a routing engine for an existing java program. I cloned the repo, added it to eclipse, got the examples running in their directories, everything seems good. But now when I try to use graphhopper from within the existing program I’m getting the error java.lang.NoClassDefFoundError: GraphHopper.

Here’s my minimal (not) working example for a class being called by main:

package distanceFactor;

import com.graphhopper.GraphHopper;
import com.graphhopper.config.CHProfile;
import com.graphhopper.config.Profile;



public class SIM_Routing_Graphhopper {
	public SIM_Routing_Graphhopper() {
        String relDir = "/Users/Admin/git/graphhopper/graphhopper/";
        GraphHopper hopper = createGraphHopperInstance(relDir + "cincinnati.pbf");
        //routing(hopper);
	}
	
    static GraphHopper createGraphHopperInstance(String ghLoc) {
        GraphHopper hopper = new GraphHopper();
        hopper.setOSMFile(ghLoc);
        // specify where to store graphhopper files
        hopper.setGraphHopperLocation("target/routing-graph-cache");

        // see docs/core/profiles.md to learn more about profiles
        hopper.setProfiles(new Profile("car").setVehicle("car").setWeighting("fastest").setTurnCosts(false));

        // this enables speed mode for the profile we called car
        hopper.getCHPreparationHandler().setCHProfiles(new CHProfile("car"));

        // now this can take minutes if it imports or a few seconds for loading of course this is dependent on the area you import
        hopper.importOrLoad();
        return hopper;
    }
}

This fails both when graphhopper-core is added through maven, and when core and webapi are added manually into the class path in Build Path.

Any thoughts are suggestions would be greatly appreciated!

Powered by Discourse