我需要一些错误的帮助
我得到的错误是
Exception in thread "main" java.lang.NoClassDefFoundError: org/j3d/aviatrix3d/DrawableSurface
at org.web3d.ogl.browser.X3DOGLBrowserFactoryImpl.createComponent(X3DOGLBrowserFactoryImpl.java:249)
at org.web3d.x3d.sai.BrowserFactory.createX3DComponent(BrowserFactory.java:185)
at xj3dtest.Xj3DTest.<init>(Xj3DTest.java:40)
at xj3dtest.Xj3DTest.main(Xj3DTest.java:54)
Caused by: java.lang.ClassNotFoundException: org.j3d.aviatrix3d.DrawableSurface
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more
C:\Users\matt\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 2 seconds)
我的代码是
package xj3dtest;
import java.awt.BorderLayout;
import java.awt.Container;
import static java.lang.Boolean.TRUE;
import javax.swing.JFrame;
import org.web3d.x3d.sai.*;
import java.util.HashMap;
public class Xj3DTest extends JFrame {
public Xj3DTest(String title) {
super(title);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Setup browser parameters
HashMap requestedParameters=new HashMap();
requestedParameters.put("Antialiased",TRUE);
requestedParameters.put("TextureQuality","medium");
requestedParameters.put("PrimitiveQuality","medium");
requestedParameters.put("Xj3D_InterfaceType","SWING");
requestedParameters.put("Xj3D_NavbarShown",TRUE);
requestedParameters.put("Xj3D_NavbarPosition","TOP");
requestedParameters.put("Xj3D_LocationShown",TRUE);
requestedParameters.put("Xj3D_LocationPosition","TOP");
requestedParameters.put("Xj3D_LocationReadOnly",TRUE);
requestedParameters.put("Xj3D_ShowConsole",TRUE);
requestedParameters.put("Xj3D_OpenButtonShown",TRUE);
requestedParameters.put("Xj3D_ReloadButtonShown",TRUE);
requestedParameters.put("Xj3D_StatusBarShown",TRUE);
requestedParameters.put("Xj3D_FPSShown",TRUE);
requestedParameters.put("Xj3D_ContentDirectory","CurrentDirectory");
requestedParameters.put("Xj3D_AntialiasingQuality","low");
requestedParameters.put("Xj3D_Culling_Mode", "frustum");
System.setProperty("x3d.sai.factory.class", "org.xj3d.ui.awt.browser.ogl.X3DOGLBrowserFactoryImpl");
BrowserFactory.setBrowserFactoryImpl(new org.web3d.ogl.browser.X3DOGLBrowserFactoryImpl());
X3DComponent x3dComponent = BrowserFactory.createX3DComponent(requestedParameters);
Browser browser = x3dComponent.getBrowser();
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
cp.add((javax.swing.JPanel)x3dComponent, BorderLayout.CENTER);
X3DScene scene = browser.createX3DFromURL(new String[] {"test.x3d"});
browser.replaceWorld(scene);
}
public static void main(String[] args) {
Xj3DTest frame = new Xj3DTest("Xj3D test");
frame.setSize(640, 480);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
我使用的Jars
是
aviatrix3d-all_3.1.0-nps.jar
commons-compress-1.10.jar
dis-enums.jar
geoapi-nogenerics-2.1.0.jar
gluegen-rt-natives-linux-amd64.jar
gluegen-rt-natives-macosx-universal.jar
gluegen-rt-natives-windows-amd64.jar
gluegen-rt-natives-windows-i586.jar
gluegen-rt.jar
gnu-regexp-1.0.8.jar
gt2-main-2.4.4.jar
gt2-metadata-2.4.4.jar
gt2-referencing-2.4.4.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
httpclient.jar
imageloader_1.1.0.jar
j3d-org-all_3.0.0-nps.jar
jai_codec.jar
jai_core.jar
jgeom-core.jar
jhall.jar
jmf.jar
joal-natives-linux-amd64.jar
joal-natives-macosx-universal.jar
joal-natives-windows-amd64.jar
joal-natives-windows-i586.jar
joal.jar
jogl-all-natives-linux-amd64.jar
jogl-all-natives-macosx-universal.jar
jogl-all-natives-windows-amd64.jar
jogl-all-natives-windows-i586.jar
jogl-all.jar
js.jar
jsr108-0.01.jar
odejava-jni.jar
odejava.jar
open-dis_4.08.jar
openmali.jar
smack.jar
smackx.jar
toxiclibscore.jar
uri.jar
vecmath.jar
vlc_uri.jar
xj3d-sai.jar
xj3d-ogl.jar
xj3d-script-base.jar
xj3d-core.jar
我将谷歌浏览器作为我的默认浏览器。我拥有的VM选项是-Xmx450M -Djava.library.path="C:\Users\matt\Documents\NetBeansProjects\jar1"
,这是我保存所有Jars
的地方。我已将包含所有Jars
的库添加到项目属性的Libraries
部分。