Cannot use installed java 3d

无人久伴 提交于 2019-12-13 16:42:26

问题


hi i'm trying to use java 3d in both command prompt and in netbeans. I have a win8 64 bit computor. I installed j3d-1_5_2-windows-amd64.exe. and it got installed inside java folder in a folder called Java3D. then I added an environmental variable as CLASSPATH and the values are C:\Program Files\Java\Java3D\1.5.2\lib\ext\j3dcore.jar;C:\Program Files\Java\Java3D\1.5.2\lib\ext\j3dutils.jar;C:\Program Files\Java\Java3D\1.5.2\lib\ext\vecmath.jar. my file get compilled without errors when I try to runit from command prompt using the command java -cp . Hello3d it gives a calss not found error for javax/media/j3d/Node. and when i try to import 3d libraries from netbeans it gives an error on j3d after import com.sun. the following is the class I compiled from command prompt. please tell me what i'm doing wrong. thanx in advance

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

回答1:


You use an obsolete version (1.5.2) of Java3D, this version is no longer maintained since a few years. Please uninstall it and install the latest version (1.6.0). Follow my instructions here.




回答2:


Your code runs perfectly in my eclipse environment using java3d version 1.5.2. It shows an ugly cube seen from one side only, red faced.

I guess you need to set the path to the native libraries that java3d needs.

Regrettably, I don't know how to do this on windows (R). Regrettably I have not enough reputation to put this into a comment rather than an answer.

If anyone with enough reputation cares, please turn this answer into a comment.



来源:https://stackoverflow.com/questions/26333045/cannot-use-installed-java-3d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!