matsim-libs icon indicating copy to clipboard operation
matsim-libs copied to clipboard

Error when running carsharing from JAR file

Open TheoChd opened this issue 2 years ago • 1 comments

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.

TheoChd avatar May 20 '22 15:05 TheoChd

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

balacmi avatar May 23 '22 11:05 balacmi