How to compile and run jbox2d

Discuss issues specific the Java port of Box2D
solace
Posts: 2
Joined: Sun Jul 06, 2014 4:43 pm

How to compile and run jbox2d

Postby solace » Sun Jul 06, 2014 5:03 pm

Hello:
after several hours of attempting to build and run jbox2d I am finally posting this, maybe helping other newbies. I downloaded jbox2d 2.3.1-SNAPSHOT, I am trying to run it on a Mac OS X 10.7.5 using java 6 (1.6.0_65). I could not find installation notes or an INSTALL file. From the existence of a pom.xml file I correctly guessed that the maven command mvn clean install compiles something, and I was after more time browsing the source code able to run SinCosTest. But analyzing the source code of this test did not teach me how to use JBox2D, only trigonometry speedups. Attempting to run org.jbox2d.testbed.framework.j2d.TestbedMain resulted in an error of a missing Google collections class java.lang.NoClassDefFoundError: com/google/common/collect/Lists. Attempting to run org.jbox2d.testbed.perf.StackTest resulted in an error of a missing Apache class; org/apache/commons/math3/stat/descriptive/DescriptiveStatistics. Attempting to run org.jbox2d.testbed.framework.jogl.JoglTestbedMain resulted in an error of a missing Jogl library class: javax/media/opengl/GLEventListener
So please: how do I install, run, use and modify JBox2D? What are the pre-requisites for building it?
Thanks!
Eckart

solace
Posts: 2
Joined: Sun Jul 06, 2014 4:43 pm

Re: How to compile and run jbox2d

Postby solace » Thu Jul 10, 2014 8:28 pm

OK, I figured it out. After spending time surmising what the missing libraries could be, and downloading (in addition to jbox2d)
1. comms-math3-3.3.jar from http://commons.apache.org/proper/common ... d_math.cgi
2. guava-17.0.jar from http://code.google.com/p/guava-libraries/
3. slf4j-api-1.7.7.jar from http://www.slf4j.org/download.html
4. Going through the source code and finding TestbedMain to be interesting and trying the following command, I found a 'portal' for a set of cool interactive test cases of Jbox2d and liquid fun:
cd to top directory of your jbox2d directory, in my case jbox2d-master, then issue (all in one command line):
java -classpath lib/slf4j-api-1.7.7.jar:lib/guava-17.0.jar:lib/commons-math3-3.3/comms-math3-3.3.jar:jbox2d-library/target/jbox2d-library-2.3.1-SNAPSHOT.jar:jbox2d-testbed-jogl/target/jbox2d-testbed-jogl-2.3.1-SNAPSHOT.jar:jbox2d-testbed/target/jbox2d-testbed-2.3.1-SNAPSHOT.jar:jbox2d-serialization/target/jbox2d-serialization-2.3.1-SNAPSHOT.jar org.jbox2d.testbed.framework.j2d.TestbedMain
Piece of cake! ~


Return to “Java”



Who is online

Users browsing this forum: No registered users and 2 guests