Friday, August 3, 2012

Configure Eclipse and Java 3D in Linux( Ubuntu 10.10 )

At the very beginning we need to install Java 3d.

Installation:
- Open the terminal ( Applications >> Accessories >> Terminal  )
- Type the following command
       sudo apt-get install libjava3d-java

After that we need to copy some files.
Copying Files:
- Copy the following jar files 
                j3dcore-1.5.2+dfsg.jar , 
                j3dcore.jar , 
                j3dutils-1.5.2+dfsg.jar , 
                j3dutils.jar , 
                vecmath.jar
to  $JAVA_HOME/jre/lib/ext folder. I found ( hope you also will ) the above files in 
/usr/share/java folder. You can use the following commands to do that
       sudo cp -i /usr/share/java/j3d*.jar $JAVA_HOME//jre/lib/ext
       sudo cp -i /usr/share/java/vecmath.jar $JAVA_HOME//jre/lib/ext
In my case , $JAVA_HOME = /usr/lib/jvm/java-6-sun-1.6.0.24 .


- Copy the libj3dcore-ogl.so to any of the directory that has been pointed out in LD_LIBRARY_PATH . The file is located in /usr/lib/jni/ folder . (This folder may already be in your LD_LIBRARY_PATH. Then copying is not needed ) .  I copied it to 
$JAVA_HOME/java-6-sun-1.6.0.24/jre/lib/i386. You can use the following command 
        sudo cp -i /usr/lib/jni/libj3dcore-ogl.so $JAVA_HOME//jre/lib/i386.


Eclipse Integration:
- Create a new Java Project.
- At project's build path select "Add external archive".
- Point out the following jar files 
       j3dcore.jar , 
       j3dutils.jar , 
       vecmath.jar         


Testing:
You can find a sample program in the tutorial hosted in site.




  




        

3 comments: