gpt4 book ai didi

java - Windows 8 上的 lockAndInitHandle 错误

转载 作者:可可西里 更新时间:2023-11-01 10:46:49 25 4
gpt4 key购买 nike

我正在 Windows 8 PC 上使用 Lwjgl-2.9.1 开发 Java 应用程序。
我正在使用 Eclipse (Kepler) 作为开发工具。
在 Eclipse 中运行该应用程序工作正常。但是当我打包应用程序时在 jar 文件中,然后从 .bat 文件运行它,
使用 Jdk 1.7-45,出现以下错误:

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: org.lwjgl.opengl.AWTSurfaceLock.lockAndInitHandle(Ljava/nio/ByteBuffer;Ljava/awt/Canvas;Z)Z
at org.lwjgl.opengl.AWTSurfaceLock.lockAndInitHandle(Native Method)
at org.lwjgl.opengl.AWTSurfaceLock.access$100(AWTSurfaceLock.java:51)
at org.lwjgl.opengl.AWTSurfaceLock$1.run(AWTSurfaceLock.java:94)
at org.lwjgl.opengl.AWTSurfaceLock$1.run(AWTSurfaceLock.java:92)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.opengl.AWTSurfaceLock.privilegedLockAndInitHandle(AWTSurfaceLock.java:92)
at org.lwjgl.opengl.AWTSurfaceLock.lockAndGetHandle(AWTSurfaceLock.java:66)
at org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo.doLockAndInitHandle(WindowsAWTGLCanvasPeerInfo.java:58)
at org.lwjgl.opengl.PeerInfo.lockAndGetHandle(PeerInfo.java:85)
at org.lwjgl.opengl.AWTGLCanvas.paint(AWTGLCanvas.java:320)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264)
at sun.awt.RepaintArea.paint(RepaintArea.java:240)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:347)
at java.awt.Component.dispatchEventImpl(Component.java:4937)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

在确认了AWTSurfaceLock类的来源后,貌似产生了错误
在 Dll 文件中调用 native 函数时。调用的 native 函数是:lockAndInitHandle(lock_buffer, component);(2 个参数)
但是根据互联网上的不同站点,AWTSurfaceLock 类的某些版本使用第三个参数调用该函数:
lockAndInitHandle(ByteBuffer lock_buffer, Canvas component, Canvas display_parent)

我应该使用哪个版本的 Lwjgl 和 Java JDK?
Eclipse 是否运行自己的 JRE?

最佳答案

参见 documentation of Lwjgl : java -Djava.library.path="natives/"-jar MyJar.jar

或者:System.setProperty("org.lwjgl.librarypath", new File("natives").getAbsolutePath());

因为需要找到原生库。

在 Eclipse 中,我想您已经在项目中设置了 native 路径。

关于java - Windows 8 上的 lockAndInitHandle 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20857723/

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