You are currently browsing the Carl's notes weblog archives for May, 2010.

Java3D in Ubuntu

Java3D and vecmath exist as packages in the Ubuntu repositories but don’t seem to be installed to the classpath. After running

sudo aptitude install libvecmath1.2-java libjava3d-java

you’ll get the following errors.

package javax.vecmath does not exist
import javax.vecmath.Color3f;
...
package javax.media.j3d does not exist
import javax.media.j3d.Behavior;

The solution is to copy the relevant jar files to somewhere they will be found.

sudo cp /usr/share/java/j3d*.jar /usr/lib/jvm/java-6-sun/jre/lib/ext/
sudo cp /usr/share/java/vecmath*.jar /usr/lib/jvm/java-6-sun/jre/lib/ext/

There may be a similar problem with the native libraries which would be solved by copying the .so files to /lib or /usr/lib and running

sudo ldconfig