Error When Creating GraphHopper Routing Data via ./graphhopper.sh

Hi …
I wanna implement GraphHopper in my app , i know that need .map file for rendering in vtm And GraphHopper Routing file … According to documention But when i use ./graphhopper.sh -a import -i <osm.bpf file> occur Error :

./graphhopper.sh -a import -i iran-latest.osm.pbf 
## using java 1.8.0_162 (64bit) from /opt/jdk/jdk1.8.0_162
./graphhopper.sh: line 128: mvn: command not found
## using existing osm file iran-latest.osm.pbf
## existing jar found web/target/graphhopper-web-0.11-SNAPSHOT.jar
## now import. JAVA_OPTS=-Xmx1000m -Xms1000m -server
Error: Could not find or load main class  

can any one Help me to create files ? !
thanks .

Are you using windows? If yes, please have a look into the specific documentation.

Also checkout the latest stable branch 0.10 (and use its documentation) instead of master.

tnx . No , Ubuntu 16.04
maven has not installed so run sudo apt-get install maven now maven 3.3.9 installed But Still Has error :

./graphhopper.sh -a import -i iran-latest.osm
## using java 1.8.0_162 (64bit) from /opt/jdk/jdk1.8.0_162
## using existing osm file iran-latest.osm
## existing jar found web/target/graphhopper-web-0.11-SNAPSHOT.jar
## now import. JAVA_OPTS=-Xmx1000m -Xms1000m -server
Error: Could not find or load main class  
./graphhopper.sh: line 256: -jar: command not found

changed to branch 0.10 .0
I do not know what happened !

it’s terminal log :

./graphhopper.sh -a import -i '/home/sm/Desktop/osm_map/iran-latest.osm.pbf' 
## using java 1.8.0_162 (64bit) from /opt/jdk/jdk1.8.0_162
./graphhopper.sh: line 175: [: ==: unary operator expected
## building graphhopper jar: tools/target/graphhopper-tools-0.10-SNAPSHOT-jar-with-dependencies.jar
## using maven at /usr/share/maven
## now -a. JAVA_OPTS=-Xmx1000m -Xms1000m -server

It is not required to install maven. Just a JDK is required. What does

java -version

print?

1.8.0_162

$ java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

And what about javac -version?

When using branch 0.10 you should do:

./graphhopper.sh import /home/sm/Desktop/osm_map/iran-latest.osm.pbf

1 Like

Solved .
Thanks @karussell … on branch 0.10 I used this command :

./graphhopper.sh import /home/sm/Desktop/osm_map/iran-latest.osm.pbf

maybe I’d better point out this when i using Desktop App on windows to create create Graph , nodes_ch_fastest_car And shortcuts_fastest_car files Not created .

I’m facing the same problem.
This is my java version

alex@descartes:graphhopper$ java -version
java version “1.8.0_111”
Java™ SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot™ 64-Bit Server VM (build 25.111-b14, mixed mode)

Javac version:

alex@descartes:graphhopper$ javac -version
javac 1.7.0_101

I’ve tried ./graphhopper.sh -a import -i panama.pbf and ./graphhopper.sh import panama.pbf in any case it did not work.

alex@descartes:graphhopper$ ./graphhopper.sh import panama-latest-7-jun.osm.pbf
.## using java 1.8.0_111 (64bit) from /usr/lib/jvm/jdk1.8.0_111
.## using existing osm file panama-latest-7-jun.osm.pbf
.## existing jar found web/target/graphhopper-web-0.11-SNAPSHOT.jar
.## now import. JAVA_OPTS=-Xmx1000m -Xms1000m
jar = web/target/graphhopper-web-0.11-SNAPSHOT.jar
Error: Could not find or load main class
./graphhopper.sh: line 260: -jar: command not found

Hope this info be useful

I expect there is something wrong with your Java setup. It seems you have a jdk8 installed but only the jvm version 8 is used not the javac compiler from version 8. (only 1.7). Please try to configure your system so that either you get rid of 1.7 or consistently use the same version >= 8 (named as 1.8)

Then you need to force re-creation of the jar e.g. via

./graphhopper.sh clean

I’m having a similar problem.

System

  • Linux Mint 18.3, which is based on Ubuntu 16.04
  • java -version gives openjdk version “9-internal”
    OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
    OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)
  • javac -version gives javac 1.8.0_171

Error

Following the GTFS Quickstart directions, i get an error on the penultimate step:

~/graphhopper (master)$ java -Xmx8g -Xms8g \
>   -Dgraphhopper.datareader.file=brandenburg-latest.osm.pbf \
>   -Dgraphhopper.gtfs.file=gtfs-vbb.zip \
>   -Dgraphhopper.graph.flag_encoders=pt \
>   -Dgraphhopper.prepare.ch.weightings=no \
>   -Dgraphhopper.graph.location=./graph-cache \
>   -jar web/target/graphhopper-web-*.jar server config.yml
java.lang.NoClassDefFoundError: javax/annotation/Priority
	at org.glassfish.jersey.model.internal.ComponentBag.modelFor(ComponentBag.java:483)
	at org.glassfish.jersey.model.internal.ComponentBag.access$100(ComponentBag.java:89)
	at org.glassfish.jersey.model.internal.ComponentBag$5.call(ComponentBag.java:408)
	at org.glassfish.jersey.model.internal.ComponentBag$5.call(ComponentBag.java:398)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
	at org.glassfish.jersey.model.internal.ComponentBag.registerModel(ComponentBag.java:398)
	at org.glassfish.jersey.model.internal.ComponentBag.register(ComponentBag.java:309)
	at org.glassfish.jersey.model.internal.CommonConfig.register(CommonConfig.java:466)
	at org.glassfish.jersey.server.ResourceConfig.register(ResourceConfig.java:453)
	at io.dropwizard.jersey.DropwizardResourceConfig.<init>(DropwizardResourceConfig.java:67)
	at io.dropwizard.jersey.DropwizardResourceConfig.<init>(DropwizardResourceConfig.java:47)
	at io.dropwizard.setup.Environment.<init>(Environment.java:80)
	at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:37)
	at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
	at io.dropwizard.cli.Cli.run(Cli.java:78)
	at io.dropwizard.Application.run(Application.java:93)
	at com.graphhopper.http.GraphHopperApplication.main(GraphHopperApplication.java:46)
Caused by: java.lang.ClassNotFoundException: javax.annotation.Priority
	at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-internal/BuiltinClassLoader.java:366)
	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-internal/ClassLoaders.java:184)
	at java.lang.ClassLoader.loadClass(java.base@9-internal/ClassLoader.java:419)
	... 19 more