matsim-org / matsim-libs

Multi-Agent Transport Simulation
www.matsim.org
477 stars 445 forks source link

Error when running carsharing from JAR file #1999

Open TheoChd opened 2 years ago

TheoChd commented 2 years ago

Hello, I'm trying to run carsharing module from JAR files. So I have generated JAR files using :mvn package -DskipTests. I'm getting an error :

Error: Unable to initialize main class org.matsim.contrib.carsharing.runExample.RunCarsharing
Caused by: java.lang.NoClassDefFoundError: org/matsim/core/population/routes/RouteFactory

when executing :java -Xmx32g -cp path_to_carsharing-15.0-SNAPSHOT.jar org.matsim.contrib.carsharing.runExample.RunCarsharing path_to_config.xml Could you please help me to solve this issue ? Thanks.

balacmi commented 2 years ago

Hello,

Unfortunately, you cannot run carsharing or any other contrib by using these JARs directly. My advice would be to create your own project and add the necessary dependencies. In your case matsim and carsharing and then package this project as a standalone JAR.

You can find the example project pom here