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();
}
}
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With