gpt4 book ai didi

Java运行时错误

转载 作者:行者123 更新时间:2023-12-02 03:48:18 25 4
gpt4 key购买 nike

我正在 java 中制作一个 Xj3D 测试文件,并且我有一个与名为 test.x3dtest.x3dv 的 X3D 和 X3DV 文件一起使用的文件,该文件是同一个文件只是有两种不同的格式,它是一个红色方 block 。但是,当我尝试放入自己的 X3D 文件时,出现以下运行时错误

run:
Mar 20, 2016 12:11:30 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Message: WARNING: antialiasing will be disabled because the DefaultGLCapabilitiesChooser didn't supply it
Mar 20, 2016 12:11:32 PM org.odejava.Odejava <clinit>
SEVERE: Native code library (32 and 64 bit library) failed to load: java.lang.UnsatisfiedLinkError: no odejava in java.library.path
java.lang.UnsatisfiedLinkError: no odejava in java.library.path
Warning: The class that you specificed for the physics manager is not a valid instance of PhysicsManager
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.odejava.Odejava.<clinit>(Odejava.java:103)
at org.xj3d.impl.core.eventmodel.DefaultRigidBodyPhysicsManager$1.run(DefaultRigidBodyPhysicsManager.java:149)
at org.xj3d.impl.core.eventmodel.DefaultRigidBodyPhysicsManager$1.run(DefaultRigidBodyPhysicsManager.java:142)
at java.security.AccessController.doPrivileged(Native Method)
at org.xj3d.impl.core.eventmodel.DefaultRigidBodyPhysicsManager.<clinit>(DefaultRigidBodyPhysicsManager.java:141)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.web3d.vrml.renderer.ogl.browser.OGLBrowserCanvas$4.run(OGLBrowserCanvas.java:1069)
at java.security.AccessController.doPrivileged(Native Method)
at org.web3d.vrml.renderer.ogl.browser.OGLBrowserCanvas.loadClass(OGLBrowserCanvas.java:1064)
at org.web3d.vrml.renderer.ogl.browser.OGLBrowserCanvas.initialize(OGLBrowserCanvas.java:694)
at org.xj3d.ui.awt.browser.ogl.BrowserJPanel.<init>(BrowserJPanel.java:256)
at org.xj3d.ui.awt.browser.ogl.X3DBrowserJPanel.<init>(X3DBrowserJPanel.java:75)
at org.xj3d.ui.awt.browser.ogl.X3DOGLBrowserFactoryImpl.createComponent(X3DOGLBrowserFactoryImpl.java:219)
at org.web3d.x3d.sai.BrowserFactory.createX3DComponent(BrowserFactory.java:263)
at xj3dtest.Xj3DTest.<init>(Xj3DTest.java:42)
at xj3dtest.Xj3DTest.main(Xj3DTest.java:56)

Message: Device found: Mouse-0
Message: Device found: Keyboard-0
Exception in thread "main" org.web3d.vrml.lang.UnsupportedNodeException: Request for a node that is not part of the specified profile and components for this stream: viewpoint
at org.web3d.vrml.renderer.DefaultNodeFactory.createVRMLNode(DefaultNodeFactory.java:730)
at org.web3d.vrml.renderer.ogl.OGLMainSceneBuilder.startNode(OGLMainSceneBuilder.java:147)
at org.web3d.vrml.renderer.ogl.OGLVRMLSceneBuilder.startNode(OGLVRMLSceneBuilder.java:514)
at org.web3d.x3d.jaxp.X3DSAVAdapter.startElement(X3DSAVAdapter.java:830)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1364)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2787)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.web3d.parser.GeneralisedReader.parse(GeneralisedReader.java:261)
at org.xj3d.impl.core.loading.DefaultWorldLoader.loadNow(DefaultWorldLoader.java:156)
at org.xj3d.impl.core.loading.DefaultWorldLoader.loadNow(DefaultWorldLoader.java:203)
at org.web3d.vrml.scripting.browser.X3DCommonBrowser.createX3DFromURL(X3DCommonBrowser.java:264)
at org.web3d.vrml.scripting.external.sai.SAIBrowser.createX3DFromURL(SAIBrowser.java:843)
at xj3dtest.Xj3DTest.<init>(Xj3DTest.java:50)
at xj3dtest.Xj3DTest.main(Xj3DTest.java:56)

我的java类如下

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.Browser;
import org.web3d.x3d.sai.BrowserFactory;
import org.web3d.x3d.sai.X3DComponent;
import org.web3d.x3d.sai.X3DScene;
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");
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[] {"hafodty_circle1.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);
}
}

我正在使用 Netbeans 对此进行编程,并且已将 hafodty_circle1.x3dhafodty_circle1.x3dv 保存在 Xj3DTest 项目中。我知道当我使用 test.x3dtest.x3dv 运行代码时出现运行时错误,但我得到了这些文件的输出,但没有得到任何输出当我运行代码时,当我有其他 x3d 文件时。任何有关此错误的帮助都意义重大,谢谢。

编辑 2016 年 1 月 4 日

在“项目属性”、“运行”菜单以及“VM 选项”中。我有以下内容:

java -Djava.library.path="C:\Users\matt\Documents\NetBeansProjects\natives\Windows_10\amd64"

java -Djava.library.path="C:\Users\matt\Documents\NetBeansProjects\natives\Windows_10\x86_64"

因为我不知道应该使用哪个odejava64.dll。现在,当我运行我的项目时,出现以下错误:

Error: Could not find or load main class java
C:\Users\matt\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)

executor-snippets中是:

<?xml version="1.0" encoding="UTF-8"?>
<project name="{0} (run)" default="run" basedir=".">
<target name="run">
<translate-classpath classpath="${classpath}" targetProperty="classpath-translated" />
<property name="run.jvmargs" value="" />
<property name="work.dir" value="${basedir}"/>
<property name="application.args" value="" />
<property name="java.failonerror" value="true"/>
<java classpath="${classpath-translated}" classname="${classname}" dir="${work.dir}" jvm="${platform.java}" fork="true" failonerror="${java.failonerror}">
<jvmarg value="-Dfile.encoding=${encoding}"/>
<redirector inputencoding="${encoding}" outputencoding="${encoding}" errorencoding="${encoding}"/>
<jvmarg line="${run.jvmargs}" />
<arg line="${application.args}" />
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
</java>
</target>
</project>

最佳答案

此错误 UnsatisfiedLinkError 意味着您缺少 native 库(如果您在 Windows 上运行,则为 odejava.dll),或者您使用的是 32 位具有 64 位 native 库的 Java,反之亦然。

确保系统属性java.library.path设置为包含 native 库的目录,并确保您的Java运行时环境的“位数”与 native 库相同(均为 32 位或均为 64 位)。

运行程序时,可以使用 -D 命令行选项设置 java.library.path 属性。例如,如果 odejava.dll 位于目录 C:\MyProject\lib 中:

java -Djava.library.path=C:\MyProject\lib com.myproject.MyMainClass

关于Java运行时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36131504/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com