-
Notifications
You must be signed in to change notification settings - Fork 180
faq 46268436
by Joe Bard on 2016-02-20 18:20:48
Hi All,
I am hoping to begin running MATSIm from the command line so eventually I can use the high performance computer at my university, but first I have to get it working on my laptop. I've tried following the instructions in the Berlin 2015 tutorial and the book but no luck thus far. Sometimes the messages returned in the terminal window (OSX) say the main class cannot be found or loaded (like in the first example) while other times I get exceptions (like example 2).
In the first example the controller is the I am trying to run is the one I made following the tutorial, but if I were trying to run the org.matsim.run.Controler I would have gotten the same message (I have tried many, many combinations of paths and class names that have returned the same message).
---------------------------------------------------------------------------------------------------------------------------------------
128-223-223-122-wireless:tutorial josephbard1$ java -Xmx2000m -cp /Users/josephbard1/.m2/repository/org/matsim/matsim/0.7.0/matsim-0.7.0.jar MyFirstController ./input/configusingtext_wcounts.xml
Error: Could not find or load main class MyFirstController
---------------------------------------------------------------------------------------------------------------------------------------
In the second example I have been able to get the computer to find something but I get an exception back.
I feel like I must be using the wrong paths or trying to use the wrong classes for this operation.
---------------------------------------------------------------------------------------------------------------------------------------
128-223-223-122-wireless:MATSIM_Project_01 josephbard1$ java -Xmx2000m -cp /Users/josephbard1/.m2/repository/org/matsim/matsim/0.7.0/matsim-0.7.0.jar org.matsim.run.Controler ./input/configusingtext_wcounts.xml
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout
at org.matsim.run.Controler.<init>(Controler.java:37)
at org.matsim.run.Controler.main(Controler.java:60)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Layout
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
---------------------------------------------------------------------------------------------------------------------------------------
Can anyone help with some insight on how to make this work? I would greatly appreciate any help getting the terminal interface to work.
Thanks in advance!
-Joe
by Kai Nagel on 2016-02-21 17:19:59
Dear Joe,
I am not an expert of Java packaging, but I am pretty sure that you cannot run the mavenized version by itself.
Instead, use the release http://matsim.org/content/quickstart if you just want to use the matsim "main distribution".
If you want to program against MATSim, I would recommend https://github.com/matsim-org/matsim-example-project . This is almost certainly the currently best option if you are familiar with maven (or have someone to help you with it).
Best
Kai
You are viewing an archive of the previous MATSim Q&A site. The real site is now at https://matsim.org/faq