java 从哪里获得 com.sun.j3d 类
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2352364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where to get com.sun.j3d classes
提问by Johanna
I have found some code snippet in the internet. But it is missing some classes. Where can I get the missing classes?
我在互联网上找到了一些代码片段。但它缺少一些类。我在哪里可以获得缺失的课程?
These are the errors I get:
这些是我得到的错误:
package com.sun.j3d.utils.universe.SimpleUniverse doesn't exist package com.sun.j3d.utils.geometry.ColorCube doesn't exist package javax.media.j3d.BranchGroup doesn't exist.
Here is the code :
这是代码:
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();
}
}
采纳答案by brabster
You'll need to include the Java3D libraries in your class path.
您需要在类路径中包含 Java3D 库。
You can get them from java3d.java.net. There's a couple of options, but you could download the build zip for your architecture, unzip it, unzip the j3d-j3d.zip, navigate to lib/ext and copy the jars you find into your classpath (-classpath path\to\j3dutils.jarfor example)
您可以从java3d.java.net获取它们。有几个选项,但您可以为您的架构下载构建 zip,解压缩它,解压缩 j3d-j3d.zip,导航到 lib/ext 并将您找到的 jars 复制到您的类路径中(-classpath path\to\j3dutils.jar例如)
We'll need more info about your environment (Are you using an IDE? Which one? Using javac from the command line? What command are you using?) if you need more help.
如果您需要更多帮助,我们将需要有关您的环境的更多信息(您使用的是 IDE 吗?哪个?从命令行使用 javac?您使用的是什么命令?)。
回答by JustJeff
Looks like maybe you don't have the java3d library installed? If you go to sun and look for java3d, they have a decent installer. If you're starting with a jdk from the sun site, the installer seems to find the right place for the java3d classes within the existing jdk/jre directory.
看起来您可能没有安装 java3d 库?如果你去 sun 寻找 java3d,他们有一个不错的安装程序。如果您从 sun 站点开始使用 jdk,安装程序似乎会在现有 jdk/jre 目录中为 java3d 类找到正确的位置。

