|
Hi:
I just downloaded 3d Java and tested on my
Windows NT pc. Strangely enough, some samples run OK but some do
not. For example the first sample I test is "Appearance", I get
following error message
"java
AppearanceTest
java.lang.NoClassDefFoundError: javax/media/j3d/Bounds Exception in thread "main"" I further tested the program and I get even more
frustrated. The program I modified as follows:
// source code I modified from
AppearanceTest
import java.applet.Applet;
import java.awt.*; import java.awt.event.*; import com.sun.j3d.utils.applet.MainFrame; import com.sun.j3d.utils.universe.*; import com.sun.j3d.utils.image.TextureLoader; import javax.media.j3d.*; import javax.vecmath.*; public class MyAppearance extends Frame//Applet
{ public static void main(String args[]) { // new MainFrame(new AppearanceTest(), 700, 700); System.out.println("Hello world"); } private Appearance createAppearance(int idx) { Appearance app = new Appearance(); // Globally used colors Color3f black = new Color3f(0.0f, 0.0f, 0.0f); Color3f white = new Color3f(1.0f, 1.0f, 1.0f); // Color3f objColor = new Color3f(1.0f, 0.2f, 0.4f); switch (idx) { // Unlit solid case 0: { // Set up the coloring properties
//????????????????????????????????????????????
// error seem appear here // when I move the following
statement above the switch statement as commented there or when ca.setColor(new
Color3f(1.0f, 0.2f, 0.4f)); the error message disappear.
Color3f objColor = new Color3f(1.0f, 0.2f, 0.4f); // ???????????????????????????????????????????? ColoringAttributes ca = new
ColoringAttributes();
// ca.setColor(new Color3f(1.0f, 0.2f, 0.4f)); ca.setColor(objColor); app.setColoringAttributes(ca); break; } default:
{ ColoringAttributes ca = new ColoringAttributes(); ca.setColor(new Color3f(0.0f, 1.0f, 0.0f)); app.setColoringAttributes(ca); }//////// } return app;
}
}
// error msg when I execute the program
/*cd d:/JavaBook/java3d/Appearance/ java MyAppearance java.lang.NoClassDefFoundError: javax/vecmath/Color3f Exception in thread "main" Compilation exited abnormally with code 1 at Wed Jun 23 15:04:05 */ Any setting wrong with JDK or Java3D? Thanks a
lot.
Taoan Ge
CS student
University of Iowa
|
- Re: [JAVA3D] 3D example "strange bug" Anonymous
- Re: [JAVA3D] 3D example "strange bug" Anonymous
