I couldn't find the option to add external libraries, but I clisked "Add External JAR files" or something like that, and added all of he JARs from the folder that J3D was installed to. I didn't get any errors when I wrote the program, but when it ran I got these
java.lang.UnsatisfiedLinkError: no J3D in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at javax.media.j3d.MasterControl$22.run(MasterControl.java:889)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:886)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:229)
at javax.media.j3d.Canvas3D.<clinit>(Canvas3D.java:3533)
at Hello3d.main(Hello3d.java:28)
Exception in thread "main"
this is the program I used
import javax.media.j3d.*;
import javax.vecmath.*;
import java.awt.*;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
public class Hello3d
{
public static void main( String[] args ) {
Frame frame = new Frame( );
frame.setSize( 640, 480 );
frame.setLayout( new BorderLayout( ) );
Canvas3D canvas = new Canvas3D( null );
frame.add( "Center", canvas );
SimpleUniverse univ = new SimpleUniverse( canvas );
univ.getViewingPlatform( ).setNominalViewingTransform( );
BranchGroup scene = createSceneGraph( );
scene.compile( );
univ.addBranchGraph( scene );
frame.show( );
}
private static BranchGroup createSceneGraph( )
{
// Make a scene graph branch
BranchGroup branch = new BranchGroup( );
// Make a changeable 3D transform
TransformGroup trans = new TransformGroup( );
trans.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE );
branch.addChild( trans );
// Make a shape
ColorCube demo = new ColorCube( 0.4 );
trans.addChild( demo );
// Make a behavor to spin the shape
Alpha spinAlpha = new Alpha( -1, 4000 );
RotationInterpolator spinner =
new RotationInterpolator( spinAlpha, trans );
spinner.setSchedulingBounds(
new BoundingSphere( new Point3d( ), 1000.0 ) );
trans.addChild( spinner );
return branch;
}
}
[/color]