tags:

views:

352

answers:

2

Hi I have found some code snippet in the internet. But it is missing some classes. Where can I get the missing classes?

These are the errors I get:

package com.sun.j3d.utils.universe.SimpleUniverse doesn't exist
package com.sun.j3d.utils.geometry.ColorCube doesn't exist
package javax.media.j3d.BranchGroup doesn't exist.

Here is the code :

import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.geometry.ColorCube;
import javax.media.j3d.BranchGroup;

public class Hello3d {

    public Hello3d()
    {

        SimpleUniverse universe = new SimpleUniverse();
        BranchGroup group = new BranchGroup();
        group.addChild(new ColorCube(0.3));
        universe.getViewingPlatform().setNominalViewingTransform();
        universe.addBranchGraph(group);
    }

    public static void main( String[] args ) {
        new Hello3d();
    }
}
+1  A: 

You'll need to include the Java3D libraries in your class path.

You can get them from java3d.dev.java.net. There's a couple of options, but you could download the build zip for your architecture, unzip it, unzip the j3d-j3d.zip, navigate to lib/ext and copy the jars you find into your classpath (-classpath path\to\j3dutils.jar for example)

We'll need more info about your environment (Are you using an IDE? Which one? Using javac from the command line? What command are you using?) if you need more help.

Brabster
how can I do that? I should download it from some where(where?) please help me thanks!
Johanna
I use netbeans IDE 6.5
Johanna
thanks for you answer I get the problem
Johanna
+1  A: 

Looks like maybe you don't have the java3d library installed? If you go to sun and look for java3d, they have a decent installer. If you're starting with a jdk from the sun site, the installer seems to find the right place for the java3d classes within the existing jdk/jre directory.

JustJeff
I should download exactly which library would you please send me the exact link because I can not go through the internet because of bad connection! thanks
Johanna
I went to this linkhttp://java.sun.com/javase/technologies/desktop/java3d/not sure what platform you have, the win32 download is about 3MB.
JustJeff