I need a little help with Java3D.

I need some help using Java3D with Eclipse. I checked under the Tools Forum, but no one posted in it since late November. Anyway, how do I configure Eclipse to use Java3D? (By the way, I already hava the Java3D files.) I’m following Sun’s Java3D tutorial, and when I paste in this code…

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.event.*;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.ColorCube;
import javax.media.j3d.*;
import javax.vecmath.*;

public class HelloJava3Da extends Applet {
	public HelloJava3Da() {
	
		setLayout(new BorderLayout());
		GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
 
		Canvas3D canvas3D = new Canvas3D(config);
		add("Center", canvas3D);

		BranchGroup scene = createSceneGraph();
		scene.compile();

		// SimpleUniverse is a Convenience Utility class
		SimpleUniverse simpleU = new SimpleUniverse(canvas3D);

		// This moves the ViewPlatform back a bit so the
		// objects in the scene can be viewed.
		simpleU.getViewingPlatform().setNominalViewingTransform();

		simpleU.addBranchGraph(scene);
		} // end of HelloJava3Da (constructor)
	
	public BranchGroup createSceneGraph() {
		// Create the root of the branch graph
		BranchGroup objRoot = new BranchGroup();
		// Create a simple shape leaf node, add it to the scene graph.
		// ColorCube is a Convenience Utility class
		objRoot.addChild(new ColorCube(0.4));
		return objRoot;
		} // end of createSceneGraph method of HelloJava3Da
} // end of class HelloJava3Da

…I get a lot of “cannot be resolved” errors. Can anyone help? Thanks a lot! ;D

As a rule of thumb: Don’t sumarize error messages when asking for help. Always paste the full error messages (or at least a significant section of them). Also try to explain in more detail, what you already have tried to set up the Java3D libraries.

I can’t really get any more specific. Well, they’re not errors at all. They’re warnings the compiler gives me before I even compile. I’ve installed Java3D, but Eclipse doesn’t seem to be finding the files.

Well, I’ve never used java3d in eclipse before so I can’t say for certain that I know what your problem is; however, from my little knowedge of eclipse, there should be a tool for adding jars. Here you need to add the java3d jars.

So for instance, if ur using GNU/Linux, then u would need to add the following jars
j3dutils.jar, vecmath.jar, j3dcore-linux.jar

This wil allow you to compile j3d; however, if you want to run it you will need to include the dynamic libs. I think there is a tool for that in eclipse to. This would include the directory that has the libj3dcore-ogl.so and libj3dcore-ogl-cg.so

Hope that helps

In Eclipse u have to create a project first to add files in it. Right click on the project name and then click on Build Path in the popup menu. furher click on Libraries and click and add the external Jar files. U need 2 add following three jar files to run java 3D programs.
j3dcore.jar
j3dutils.jar
vecmath.jar

If required more help tell me.