简体   繁体   English

获取“java.lang.UnsatisfiedLinkError”:java.library.path 中没有 lwjgl

[英]Getting 'java.lang.UnsatisfiedLinkError': no lwjgl in java.library.path

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.请注意,这与此问题不同,因为它不涉及链接,因为它不询问如何通过 CLI 进行链接,而是询问 Eclipse 中的 GUI。

I have been trying to write a simple program using LWJGL.我一直在尝试使用 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.当我将库添加到 Eclipse(Windows 7 64 位上的开普勒 4.3.1)并编写程序时,它不会在使用 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.请注意,即使在 Eclipse 中运行,它仍然会失败。 If I run something else which does not use LWJGL it works, too.如果我运行其他不使用 LWJGL 的东西,它也可以工作。 I just downloaded it from the inte.net - it only had one version, so I assume it was the correct one.我刚从 inte.net 下载它 - 它只有一个版本,所以我认为它是正确的。 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.您没有在 LWJGL 应用程序中设置本机。

Here's how to do it:这是如何做到的:

  1. Go to your LWJGL folder that contains the folders named "jar", "res", "doc", and "native".转到包含名为“jar”、“res”、“doc”和“native”的文件夹的 LWJGL 文件夹。 You need to go into Eclipse (assuming you use eclipse), open your project in the Project Explorer on the left side of your screen.您需要进入 Eclipse(假设您使用 eclipse),在屏幕左侧的 Project Explorer 中打开您的项目。
  2. Right click on the "JRE System Library" of your project, and click "Build Path" -> "Configure Build Path".右键单击您项目的“JRE 系统库”,然后单击“构建路径”->“配置构建路径”。
  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.通过单击可在 JRE 系统库下拉菜单中看到的“本机库位置”,将 LWJGL 本机库包含到您的项目中的构建路径配置器中。
  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].导航到 LWJGL 本机文件夹的位置(如果您使用的是 Windows,该位置应该类似于“C:\\Users\\YOURUSERNAMEHERE\\Desktop\\Java\\eclipse\\lwjgl-2.9.0\\native”)并包含名为 [你的操作系统在这里]。

Hope this helped :)希望这有帮助:)

I was following the tutorial here , and it looks like I didn't do the Adding the natives step, or I did it incorrectly.我正在关注这里的教程,看起来我没有执行添加本地人步骤,或者我做错了。

Follow the instructions in that link and the problem should be resolved:按照该链接中的说明操作,问题应该得到解决:

This is done by clicking the little arrow next to the lwjgl.jar file to show the drop down list.这是通过单击 lwjgl.jar 文件旁边的小箭头显示下拉列表来完成的。 Double click 'Native library location' and select the folder that contains the native files for your operating system and clicking OK.双击“本机库位置”并选择包含操作系统本机文件的文件夹,然后单击“确定”。 These are located in the natives folder include in the LWJGL download bundle (eg On Windows you'd point to the natives\\windows folder which contains the *.dll files, On Mac you'd point to the natives/macosx folder and on Linux you'd point to the natives/linux folder).这些位于 LWJGL 下载包中的 natives 文件夹中(例如,在 Windows 上,您将指向包含 *.dll 文件的 natives\\windows 文件夹,在 Mac 上,您将指向 natives/macosx 文件夹,在 Linux 上你会指向 natives/linux 文件夹)。

If you try tu run this code:如果您尝试运行此代码:

public static void main(String... args){
    System.out.println(System.getProperty("java.library.path"));
}

you should get output like this: /Users/yourName/.sdkman/candidates/java/8.0.252.j9-adpt/jre/lib/compressedrefs:/Users/yourName/.sdkman/candidates/java/8.0.252.j9-adpt/jre/lib:/usr/lib你应该得到这样的输出:/Users/yourName/.sdkman/candidates/java/8.0.252.j9-adpt/jre/lib/compressedrefs:/Users/yourName/.sdkman/candidates/java/8.0.252.j9 -adpt/jre/lib:/usr/lib

So, you just need to download LWJGL libraries and copy files located at "...native/yourOSname" to one of this folders因此,您只需下载 LWJGL 库并将位于“...native/yourOSname”的文件复制到此文件夹之一

That works to me fine!这对我很好!

I solved the issue by adding the lwjgl.64.dll file to the jdk-14.0.1 bin folder我通过将 lwjgl.64.dll 文件添加到 jdk-14.0.1 bin 文件夹中解决了这个问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 LWJGL&#39;java.lang.UnsatisfiedLinkError&#39;:java.library.path中没有lwjgl - LWJGL 'java.lang.UnsatisfiedLinkError': no lwjgl in java.library.path LWJGL Applet java.lang.UnsatisfiedLinkError:java.library.path中没有lwjgl - LWJGL Applet java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path 臭名昭著的“java.lang.UnsatisfiedLinkError:java.library.path 中没有 lwjgl64” - Infamous "java.lang.UnsatisfiedLinkError: no lwjgl64 in java.library.path" 线程“main”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有lwjgl - Exception in thread “main” java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path 线程“ main”中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有lwjgl-devil - Exception in thread “main” java.lang.UnsatisfiedLinkError: no lwjgl-devil in java.library.path java.lang.UnsatisfiedLinkError:java.library.path中没有lwjgl,但是设置了本机 - java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path but natives are set java.lang.UnsatisfiedLinkError:否 <LIBRARY> 在java.library.path中 - java.lang.UnsatisfiedLinkError: no <LIBRARY> in java.library.path java.lang.unsatisfiedlinkerror:java.library.path中没有vtk CommonJava - java.lang.unsatisfiedlinkerror: no vtk CommonJava in java.library.path java.lang.UnsatisfiedLinkError:java.library.path中不这样 - java.lang.UnsatisfiedLinkError: no so in java.library.path java.lang.UnsatisfiedLinkError:java.library.path 中没有“somefile” - java.lang.UnsatisfiedLinkError: no "somefile" in java.library.path
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM