Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to get com.sun.j3d classes

Tags:

java

netbeans

3d

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();
    }
}
like image 212
Johanna Avatar asked Feb 28 '10 19:02

Johanna


2 Answers

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

You can get them from java3d.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.

like image 149
brabster Avatar answered Oct 09 '22 16:10

brabster


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.

like image 26
JustJeff Avatar answered Oct 09 '22 16:10

JustJeff