Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Mac 3D Graphics

843789Oct 7 2009 — edited Oct 7 2009
For a programming class we have been provided with the following code:
import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.geometry.Sphere;
import javax.media.j3d.BranchGroup;
public class CubeSimple
{
 public CubeSimple()
 {
 SimpleUniverse universe = new SimpleUniverse();
 BranchGroup group = new BranchGroup();
 ColorCube cube = new ColorCube (0.4);
 
 group.addChild(cube);
 
 universe.getViewingPlatform().setNominalViewingTransform();
 universe.addBranchGraph(group);
 }
 
 public static void main(String[] args)
 {
   new CubeSimple();
 }
}
We were told we need to import the java 3d library to our computers. Our teacher has figured out how to do this on the Linux machines but the mac users in the class are having trouble. When running the code in DrJava without doing anything I get the error: "package com.sun.j3d.utils.universe does not exist". I downloaded the Mac OS X zip binary from here. From sheer guessing, I navigated to HD>Library>Java>Extensions and dropped in the 3 .jar files I was given (j3dcore, j3dutils, and vecmath). Now the code would compile but when I click run DrJava gives me this error in a popup: edu.rice.cs.util.UnexpectedException: java.lang.NoClass and nothing happens.

I am running Snow Leopard and I do have Xcode installed if it would do this better but I have no idea how to make Xcode compile and run a simple code like this. I have also noticed the readme installation instructions included with the library download but they are very confusing to me. If following these instructions is definitely all I have to do to fix my problem then a simpler breakdown of the instructions would be a lifesaver.

Thank you so much!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 4 2009
Added on Oct 7 2009
3 comments
307 views