程序
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.DirectionalLight;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3f;import com.sun.j3d.utils.geometry.Sphere;
import com.sun.j3d.utils.universe.SimpleUniverse;public class hello
{
public hello() {
SimpleUniverse a=new SimpleUniverse();
BranchGroup d=new BranchGroup();
Sphere s=new Sphere(0.5f);
d.addChild(s);
 Color3f light=new Color3f(1.0f,1.0f,1.0f);
 BoundingSphere t=new BoundingSphere(new Point3d(0.0,0.0,0.0),100.0);
 Vector3f f=new Vector3f(4.0f,-4.0f,-12.0f);
 DirectionalLight e=new DirectionalLight(light,f);
e.setInfluencingBounds(t);
d.addChild(e);
a.getViewingPlatform().setNominalViewingTransform();
a.addBranchGraph(d);
}
public static void main(String[] args)
{
new hello();
}
}导入了下面几个包j3daudio.jar
j3dcore.jar
j3dutils.jar
vecmath.jar

解决方案 »

  1.   

    错误是:
    xception in thread "main" java.lang.UnsatisfiedLinkError: no J3D in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1030)
    at javax.media.j3d.MasterControl$12.run(MasterControl.java:693)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:690)
    at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:206)
    at hello.<init>(hello.java:16)
    at hello.main(hello.java:31)
      

  2.   

    如果那个 wrl 文件在jar文件里 不需数字签名
    检查:使用到的文件是否都在jar中, 或在所执行的jar所在目录下(服务器),不能是本地的某个目录里