获取“java.lang.UnsatisfiedLinkError”:java.library.path中的lwjgl [英] Getting 'java.lang.UnsatisfiedLinkError': no lwjgl in java.library.path

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

问题描述

注意这不同于这个问题,因为它不处理链接,因为它不是要求如何通过CLI链接它,而是Eclipse中的GUI。



我一直在尝试用LWJGL编写一个简单的程序。当我将库添加到Eclipse(Windows 7 64bit上的开普勒4.3.1)并编写一个程序时,它不会在使用LWJGL的东西下显示红色的波形。但是,尝试运行它给我以下堆栈跟踪:

 线程main中的异常java.lang.UnsatisfiedLinkError:no lwjgl在java.library.path 
在java.lang.ClassLoader.loadLibrary(未知源)
在java.lang.Runtime.loadLibrary0(未知源)
在java.lang.System.loadLibrary (未知来源)
在org.lwjgl.Sys $ 1.run(Sys.java:73)
在java.security.AccessController.doPrivileged(本机方法)
在org.lwjgl.Sys .doLoadLibrary(Sys.java:66)
在org.lwjgl.Sys.loadLibrary(Sys.java:95)
在org.lwjgl.Sys。< clinit>(Sys.java:112)
在org.lwjgl.opengl.Display。< clinit>(Display.java:135)
在DisplayExample.start(DisplayExample.java:8)
在DisplayExample.main(DisplayExample。 java:23)

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



我的问题是,如何d o我修复了这个错误?请注意,即使在Eclipse中运行,它仍然失败。如果我运行的东西不使用LWJGL,它也可以工作。我只是从互联网下载它 - 它只有一个版本,所以我认为这是正确的。从我可以看到,其他问题的问题都没有与我一样的错误 - 但是如果你能指出一些有用的问题,那么这个问题也是有帮助的。

解决方案

您的LWJGL应用程序中没有设置本地用户。



以下是如何执行的:


  1. 转到包含名为jar,res,doc和native的文件夹的LWJGL文件夹。您需要进入Eclipse(假设您使用eclipse),在屏幕左侧的Project Explorer中打开您的项目。

  2. 右键单击您的JRE系统库项目,然后单击构建路径 - >配置构建路径。

  3. 通过单击本地库位置,将构建路径配置程序中的LWJGL本机库包含到您的项目中,在JRE系统库下拉菜单中可以看到。

  4. 点击编辑...,这是该区域唯一可点击的按钮。

  5. 将弹出文件浏览器。导航到您的LWJGL本地文件夹的位置(如果您使用Windows,该位置应该像C:\Users\YOURUSERNAMEHERE\Desktop\Java\eclipse\lwjgl-2.9.0\\\
    ative ),并包含名为[您的操作系统在这里]的文件夹。

希望这有帮助:)


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.

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)

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.

解决方案

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

Here's how to do it:

  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:\Users\YOURUSERNAMEHERE\Desktop\Java\eclipse\lwjgl-2.9.0\native" if you are using Windows) and include the folder named [Your OS here].

Hope this helped :)

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

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