faq 34045973 - matsim-org/matsim-code-examples GitHub Wiki
by Kai Nagel on 2015-08-27 11:13:36
by Kai Nagel on 2015-08-27 11:13:51
Java may try to access some X11 features when creating image buffers for graphs. If your server doesn't have X11 installed, this leads to Exceptions like
Exception in thread "main" java.lang.NoClassDefFoundError:
Could not initialize class sun.awt.X11GraphicsEnvironment
Try starting MATSim with the Java option -Djava.awt.headless=true
set, i.e.:
java -Djava.awt.headless=true -cp MATSim.jar org.matsim.run.Controler config.xml
by Johan W. Joubert on 2015-10-22 10:14:38
This actually occurs on Mac too, so the question is relevant for non-servers too. My error was somewhat different, but it was related to generating link stat graphs.
I have a new MacMini that does not have any other applications that require X11, so I've never installed XQuartz or the like. But Kai's solution above works perfectly for the Mac too (and will probably for any Unix-based system).