This page explains how to run programs that use the Java3D library in Eclipse.
-
Download Java3D.
Visit this page to downloadthe Java3D library for your system.
-
The download for Windows includes an installer. I found it easiest to install the Java3D files and directories in my Java folder, the same one that contains the download for standard java, jdk1.6.0_18 in my case. After running the installer:
-
Start Eclipse. You can either create a new project for your Java3D code or use a preexisting project. I will create a new project named 3DExamples
-
Download HelloUniverse.java and add it the project from step 3.
HelloUniverse.java has a lot of syntax errors because it refers to a number of non standard classes in Java3D. We need to tell the project where to look for these classes. -
In the Eclipse menu, selectProject -> Properties
-
In the window that pops up selectJava Build Pathand then click theAdd Library...button.
-
In the next window selectUser Libraryand click theNextbutton.
-
In the next window click theUser libraries ...button
-
In the next click theNew ...button.
-
In the window that pops up give the new library a name. I use the name Java3DLib. Then click theOKbutton.
-
Select the library you just created and then click theAdd JARs ...button.
-
In the file selector that pops up navigate to the folder where you installed Java3D in step 2. (On my machine the path to the jar files for Java3D is Java3D -> 1.5.2 -> lib -> ext ->) Select all three jar files (j3dcore.jar, j3dutils.jar, and vecmath.jar). After selection all three jar files click theOpenbutton
-
After adding the jars click theOkaybutton in the preferences window.
-
In the window that pops up click theFinishbutton.
-
Back in the Build Path window select the Java3DLib you just added, expand it, and select theNative Library Locationproperty. Then click the edit button.
-
In the window that pops up click theExternal Folderbutton.
-
In the window that pops up, browse to thebinfolder in your Java3D folder. (On my machine this was at Java3D -> 1.5.2 -> bin) Select the folder then clickOkay.
-
Close the preferences window. HelloUniverse should now compile without any syntax errors. When you run the program you should see a spinning colored cube.
-
You can download more example programs for Java3D here.(download the zip file, unzip it, and then you can add classes / programs with examples to Eclipse)
-
You can access the documentation for the Java3D classes here.
-
You can download the documentation to install or your own machine here.