How to use Graphhopper In Java by custom Profile?

I search some use custom profile example in github ,but i can’t run the application.
Graphhopper version is 7.0.
Here is my code:

 customModel = new CustomModel();
 customModel.addToPriority(If("road_class == MOTORWAY", MULTIPLY, "0.1"));

   GraphHopper hopper = new GraphHopper();
        hopper.setGraphHopperLocation(parentPath + File.separator + cacheName + File.separator);
        // see docs/core/ to learn more about profiles
Profile profile = new CustomProfile("car_custom").setCustomModel(customModel).setVehicle("car").setWeighting("custom");
        hopper.getLMPreparationHandler().setLMProfiles(new LMProfile("car_custom"));

        // now this can take minutes if it imports or a few seconds for loading of course this is dependent on the area you import


java.lang.NoSuchFieldError: typeParameters
	at com.graphhopper.routing.weighting.custom.CustomModelParser.injectStatements(
	at com.graphhopper.routing.weighting.custom.CustomModelParser.access$100(
	at com.graphhopper.routing.weighting.custom.CustomModelParser$2.copyMethodDeclarator(
	at org.codehaus.janino.util.DeepCopier.copyPackageMemberClassDeclaration(
	at org.codehaus.janino.util.DeepCopier$3.visitPackageMemberClassDeclaration(
	at org.codehaus.janino.util.DeepCopier$3.visitPackageMemberClassDeclaration(
type or paste code here

Never had this error. How do you include the external library janino? Maybe the version you use is outdated. Please ensure to use the version specified in the pom.xml (3.1.2)

I use this dependency in Java,it has include the external library janino


Based on your ideas, I have reviewed the versions of all packages and found that,the version of “org.codehaus.janino” error,it is 3.1.0 instead of 3.1.2.
After I modify it ,it works!
Thanks you very much!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.