获取“java.lang.UnsatisfiedLinkError":java.library.path 中没有 lwjgl [英] Getting 'java.lang.UnsatisfiedLinkError': no lwjgl in java.library.path

查看:32
本文介绍了获取“java.lang.UnsatisfiedLinkError":java.library.path 中没有 lwjgl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意这与 这个问题 因为它不处理链接,因为它不询问如何通过 CLI 链接它,而是询问 Eclipse 中的 GUI.

Note this is different from this question because it does not deal with linking because it's not asking how to link it via the CLI, but the GUI in Eclipse.

我一直在尝试使用 LWJGL 编写一个简单的程序.当我将库添加到Eclipse(Windows 7 64位上的Kepler 4.3.1)并编写程序时,它在使用LWJGL的东西下没有显示红色波浪线.但是,尝试运行它会给我以下堆栈跟踪:

I have been trying to write a simple program using LWJGL. When I add the library to Eclipse (Kepler 4.3.1 on Windows 7 64bit) and write a program, it does not show red squigglies under the the things which use LWJGL. However, trying to run it gives me the following stacktrace:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at org.lwjgl.Sys$1.run(Sys.java:73)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
    at org.lwjgl.Sys.loadLibrary(Sys.java:95)
    at org.lwjgl.Sys.<clinit>(Sys.java:112)
    at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
    at DisplayExample.start(DisplayExample.java:8)
    at DisplayExample.main(DisplayExample.java:23)

(是的,这是他们首先给出的示例,但我想运行它以确保一切都正确安装)

(Yes, that is the example they give first, but I wanted to run it to make sure everything was installled properly)

我的问题是,我该如何解决这个错误?请注意,即使在 Eclipse 中运行,它仍然会失败.如果我运行其他不使用 LWJGL 的东西,它也可以工作.我刚刚从互联网上下载了它 - 它只有一个版本,所以我认为它是正确的.据我所知,其他提问者都没有像我一样犯过同样的错误——但如果你能指出我也能提供有用的信息性问题.

My question is, how do I fix this error? Note that, even when running in Eclipse, it still fails. If I run something else which does not use LWJGL it works, too. I just downloaded it from the internet - it only had one version, so I assume it was the correct one. From what I can see, none of the other question askers have the same error as me - but if you could point me to informative questions that would be helpful too.

推荐答案

您没有在 LWJGL 应用程序中设置本地程序.

You don't have the natives set up in your LWJGL application.

方法如下:

  1. 转到包含名为jar"、res"、doc"和native"的文件夹的 LWJGL 文件夹.您需要进入 Eclipse(假设您使用 Eclipse),在屏幕左侧的 Project Explorer 中打开您的项目.
  2. 右键单击您项目的JRE 系统库",然后单击构建路径"->配置构建路径".
  3. 点击 JRE 系统库下拉菜单中的本机库位置",将 LWJGL 本机库添加到您的项目的构建路径配置器中.
  4. 点击编辑...",这将是该一般区域中唯一可点击的按钮.
  5. 会弹出一个文件浏览器.导航到 LWJGL 本机文件夹的位置(如果您使用的是 Windows,该位置应该类似于C:UsersYOURUSERNAMEHEREDesktopJavaeclipselwjgl-2.9.0 ative")并包含名为 [此处为您的操作系统].
  1. Go to your LWJGL folder that contains the folders named "jar", "res", "doc", and "native". You need to go into Eclipse (assuming you use eclipse), open your project in the Project Explorer on the left side of your screen.
  2. Right click on the "JRE System Library" of your project, and click "Build Path" -> "Configure Build Path".
  3. Include the LWJGL native libraries to your project in the Build Path Configurer by clicking the "Native library location" which can be seen in the JRE System Library dropdown menu.
  4. Click on "Edit...", which will be the only button clickable in that general area.
  5. A file explorer will pop up. Navigate to the location of your LWJGL native folder (The location should be something like "C:UsersYOURUSERNAMEHEREDesktopJavaeclipselwjgl-2.9.0 ative" if you are using Windows) and include the folder named [Your OS here].

希望这有帮助:)

这篇关于获取“java.lang.UnsatisfiedLinkError":java.library.path 中没有 lwjgl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆