IntelliJ Maven project has UnsatisfiedLinkError: failed to locate library: lwjgl.dll

IntelliJ Maven project has UnsatisfiedLinkError: failed to locate library: lwjgl.dll

我已将现有的多模块 Maven 项目导入 IntelliJ。父项目本身构建并且 运行 很好,但我正在尝试 运行 自己的模块之一(弹出式查看器 window)。当我这样做时,出现此错误:

[LWJGL] Failed to load a library. Possible solutions:
a) Add the directory that contains the shared library to -Djava.library.path or -Dorg.lwjgl.librarypath.
b) Add the JAR that contains the shared library to the classpath.
[LWJGL] Enable debug mode with -Dorg.lwjgl.util.Debug=true for better diagnostics.
[LWJGL] Enable the SharedLibraryLoader debug mode with -Dorg.lwjgl.util.DebugLoader=true for better diagnostics.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to locate library: lwjgl.dll

我不确定如何解决这个问题,我对整个项目的构建方式感到困惑,运行没问题,但是模块有问题 运行ning。 lwjgl 包含在 pom.xml 中,所以 Maven 不应该处理这个依赖关系吗?

从这个link:

http://forum.lwjgl.org/index.php?topic=6428.0

"The lwjgl-*-natives-* jar files should be added as "类",而不是 "Native Library Locations"。它们必须在 class 路径中,LWJGL 才能自动发现、提取和加载他们。 我认为 IntelliJ 中的 "Native Library Locations" 只有在它指向文件夹位置时才有效,并且具有预提取的本机库。它可能将这些文件夹作为路径传递给 -Djava.library.path。 LWJGL 也支持这一点,但这意味着您必须自己从 jars 中提取本机库。"

看来你必须自己提取它们..

我不太熟悉 maven,但我会考虑配置它来设置它,所以这是自动在 class 路径上,在通过 Intellij 配置它检查它是否工作后。

所以我的问题原来是我在 Windows 计算机上,但是我得到的项目配置了 pom.xml,所以只有 lwjgl native-macos jar 已下载。我通过编辑主要 pom.xml 来包含 mac 和 windows 的两个单独的配置文件并在分类器中使用它们来解决这个问题。

在我弄明白之前,我通过从 https://www.lwjgl.org/download, extracting the jar files, and storing them as a library in IntelliJ under File > Project Structure. (I followed the instructions at http://wiki.lwjgl.org/wiki/Setting_Up_LWJGL_with_IntelliJ_IDEA.html)

下载 lwjgl zip 找到了解决方法