hey, so I am just starting java3D, and I am running into some pretty basic problems... I started a tutorial online (from www.java3d.org) and the first sample program is:

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();
}
} // end of class Hello3d

with error output

java.lang.NoClassDefFoundError: javax/media/j3d/Node
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
	at java.lang.Class.getMethod0(Class.java:2670)
	at java.lang.Class.getMethod(Class.java:1603)
	at edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:251)

I think (and correct me if I'm wrong) that means that the the class definiton 'javax/media/j3d/Node' in 'javax/media/j3d' does not exist, and I have to install something else.

OR, i could just be wrong about what the problem is, and I am misinterpreting the output...

In any event, how do I fix this?

Recommended Answers

All 8 Replies

I could be wrong but BranchGroup inside javax sounds doubtful.

javax is a standard java library and it does not contain a media class. if it is to contain it, you should download that. look online for javax.media library.

thank you, from that link I was lead to the download 'j3d-core-1.3.1.jar'

and from another search, I found http://www.codeguru.com/forum/archive/index.php/t-339490.html
which contains a link that leads me to download the 'JMF-2.1.1e' framework (universal port, as I am using a mac and not Windows, linux or Solaris)

I assume what I found is not right for this, but using the .jar from your link, how should I install it? Should I add it to by path? put it in my lib folder? or run it? or do something else totally different?

UPDATE:
I successfully compiled and ran the above program in Eclipse, and that Eclipse .java file via command line. In Eclipse it did run, but it asked if it should 'ignore errors and run anyway' or something...

What's the problem and/or how can I fix it?

I believe you need to put your jar file in your library folder, I'm sure the place where you got your jar should explain how to install it...

put the errors you get here and we might see what the actual problems are.

well, eclipse is running despite errors, and the program is doing what is described in the tutorial... so sorta no problems..

I guess technically the errors are this, but I sorta don't need to fix them:

Description	Resource	Path	Location	Type
Access restriction: The constructor BoundingSphere(Point3d, double) is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 29	Java Problem
Access restriction: The constructor BranchGroup() is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 17	Java Problem
Access restriction: The constructor BranchGroup() is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Hello3d.java	/escape/src	line 13	Java Problem
Access restriction: The constructor Color3f(float, float, float) is not accessible due to restriction on required library /System/Library/Java/Extensions/vecmath.jar	Ball.java	/escape/src	line 26	Java Problem
Access restriction: The constructor ColorCube(double) is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Hello3d.java	/escape/src	line 16	Java Problem
Access restriction: The constructor DirectionalLight(Color3f, Vector3f) is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 35	Java Problem
Access restriction: The constructor Point3d(double, double, double) is not accessible due to restriction on required library /System/Library/Java/Extensions/vecmath.jar	Ball.java	/escape/src	line 29	Java Problem
Access restriction: The constructor SimpleUniverse() is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Ball.java	/escape/src	line 14	Java Problem
Access restriction: The constructor SimpleUniverse() is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Hello3d.java	/escape/src	line 10	Java Problem
Access restriction: The constructor Sphere(float) is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Ball.java	/escape/src	line 20	Java Problem
Access restriction: The constructor Vector3f(float, float, float) is not accessible due to restriction on required library /System/Library/Java/Extensions/vecmath.jar	Ball.java	/escape/src	line 32	Java Problem
Access restriction: The method addBranchGraph(BranchGroup) from the type SimpleUniverse is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Ball.java	/escape/src	line 47	Java Problem
Access restriction: The method addBranchGraph(BranchGroup) from the type SimpleUniverse is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Hello3d.java	/escape/src	line 22	Java Problem
Access restriction: The method addChild(Node) from the type Group is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 23	Java Problem
Access restriction: The method addChild(Node) from the type Group is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 41	Java Problem
Access restriction: The method addChild(Node) from the type Group is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Hello3d.java	/escape/src	line 16	Java Problem
Access restriction: The method getViewingPlatform() from the type SimpleUniverse is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Ball.java	/escape/src	line 44	Java Problem
Access restriction: The method getViewingPlatform() from the type SimpleUniverse is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Hello3d.java	/escape/src	line 19	Java Problem
Access restriction: The method setInfluencingBounds(Bounds) from the type Light is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 38	Java Problem
Access restriction: The method setNominalViewingTransform() from the type ViewingPlatform is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Ball.java	/escape/src	line 44	Java Problem
Access restriction: The method setNominalViewingTransform() from the type ViewingPlatform is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Hello3d.java	/escape/src	line 19	Java Problem
Access restriction: The type BoundingSphere is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 29	Java Problem
Access restriction: The type BoundingSphere is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 29	Java Problem
Access restriction: The type BranchGroup is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 17	Java Problem
Access restriction: The type BranchGroup is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 17	Java Problem
Access restriction: The type BranchGroup is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Hello3d.java	/escape/src	line 3	Java Problem
Access restriction: The type BranchGroup is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Hello3d.java	/escape/src	line 13	Java Problem
Access restriction: The type BranchGroup is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Hello3d.java	/escape/src	line 13	Java Problem
Access restriction: The type Color3f is not accessible due to restriction on required library /System/Library/Java/Extensions/vecmath.jar	Ball.java	/escape/src	line 26	Java Problem
Access restriction: The type Color3f is not accessible due to restriction on required library /System/Library/Java/Extensions/vecmath.jar	Ball.java	/escape/src	line 26	Java Problem
Access restriction: The type ColorCube is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Hello3d.java	/escape/src	line 2	Java Problem
Access restriction: The type ColorCube is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Hello3d.java	/escape/src	line 16	Java Problem
Access restriction: The type DirectionalLight is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 35	Java Problem
Access restriction: The type DirectionalLight is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dcore.jar	Ball.java	/escape/src	line 35	Java Problem
Access restriction: The type Point3d is not accessible due to restriction on required library /System/Library/Java/Extensions/vecmath.jar	Ball.java	/escape/src	line 29	Java Problem
Access restriction: The type SimpleUniverse is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Ball.java	/escape/src	line 14	Java Problem
Access restriction: The type SimpleUniverse is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Ball.java	/escape/src	line 14	Java Problem
Access restriction: The type SimpleUniverse is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Hello3d.java	/escape/src	line 1	Java Problem
Access restriction: The type SimpleUniverse is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Hello3d.java	/escape/src	line 10	Java Problem
Access restriction: The type SimpleUniverse is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Hello3d.java	/escape/src	line 10	Java Problem
Access restriction: The type Sphere is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Ball.java	/escape/src	line 20	Java Problem
Access restriction: The type Sphere is not accessible due to restriction on required library /System/Library/Java/Extensions/j3dutils.jar	Ball.java	/escape/src	line 20	Java Problem
Access restriction: The type Vector3f is not accessible due to restriction on required library /System/Library/Java/Extensions/vecmath.jar	Ball.java	/escape/src	line 32	Java Problem
Access restriction: The type Vector3f is not accessible due to restriction on required library /System/Library/Java/Extensions/vecmath.jar	Ball.java	/escape/src	line 32	Java Problem

I believe you need to put your jar file in your library folder

when u say 'library folder' do u mean the single-user one, the one for all users or lib OR something else that I don't even know about?

'm sure the place where you got your jar should explain how to install it...

page not found :/

oh, yea, thanks, yea that helped, I got it now

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.