Skip to content

faq 183336961

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

Import matsim as maven into Eclipse

by Petr Hajduk on 2018-02-21 17:58:18


Hello,

I am having trouble importing Matsim into my Eclipse. I go through File->Import->Existing Maven Projects. So far so good, the import looks like success. But when I try to run the RunMatsim.java I get the following error (for GUI I got the same):

Exception in thread "main" java.lang.RuntimeException: java.lang.NoClassDefFoundError: gnu/trove/list/array/TDoubleArrayList at org.matsim.core.controler.MatsimRuntimeModifications.run(MatsimRuntimeModifications.java:98) at org.matsim.core.controler.MatsimRuntimeModifications.run(MatsimRuntimeModifications.java:31) at org.matsim.core.controler.AbstractController.run(AbstractController.java:99) at org.matsim.core.controler.NewControler.run(NewControler.java:79) at org.matsim.core.controler.Controler.run(Controler.java:205) at org.matsim.run.RunMatsim.main(RunMatsim.java:49)

I can clearly see the TDoubleArrayList class in my Maven dependencies and even googling for the solution did not help to fix the issue. I am using jdk1.8.0_161 and Eclipse version: Oxygen.2 Release (4.7.2).

I tried for both the release and the development version. Thank you for any help


Comments: 5


Re: Import matsim as maven into Eclipse

by Petr Hajduk on 2018-02-21 17:59:53

Note: I downloaded the folder as .zip instead of cloning from git, but I don't believe that causes the issue.


Re: Import matsim as maven into Eclipse

by Kai Nagel on 2018-02-21 19:13:02

Could you please try the following two things:

(1) force maven update. Something like right-click ➝ maven ➝ update; preferably force all updates. Then run again.

(2) If the above did not help: go into your local maven repository (under *nix at $HOME/.m2/repository), from there cd to net/sf/trove4j/trove4j and delete the directory for the version you are using (possibly 3.0.3). Then do (1) again, then try again.

I can't really say if that is the problem. It has happened in the past that maven pulled incomplete versions (identifiable by missing *.jar files in the corresponding directories) and was unable to recover by itself. :-(


Re: Import matsim as maven into Eclipse

by Johan W. Joubert on 2018-02-22 05:29:16

Hi Petr, I do not know if Eclipse actually updates (as in install) the required Maven dependencies when you do the Maven - Update Project. I find it necessary to create a run configuration where I do a formal Maven install. If you've already done that, then I'm sorry, I don't know.

On the command line it is even easier (I'm on a Mac, but Linux works the same; can't say for Windows). In the matsim folder, execute the following commands (and hope for a success):

mvn clean
 mvn install -DskipTests=true

If it ends with a success, then you do a Maven update in Eclipse. That usually works for me.


Re: Import matsim as maven into Eclipse

by Petr Hajduk on 2018-02-22 12:30:48

I believe it was some maven loading issue, I tried again on another computer and it seems to work. Thank you for your cooperation.

Petr Hajduk


Re: Import matsim as maven into Eclipse

by Petr Hajduk on 2018-02-23 15:31:09

Also, what Kai Nagel recommended works for the first computer. I had to delete the folder in the .m2 directory. Strangely enough, I got similar problem with different class. Even more strangely, applying the same procedure to solve this actually solved the problem. Looks like Maven is some sort of magic to me...
Petr Hajduk

Clone this wiki locally