【问题标题】:Eclipse can't load liblwjgl64.soEclipse 无法加载 liblwjgl64.so
【发布时间】:2016-05-28 00:45:32
【问题描述】:

我知道之前已经回答过这个问题,但没有一个有效。我尝试运行一个简单的程序,

enter code here
package tools.crystalcoffee.methods;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

public class DisplayMethod {
public void createDisplay(int width, int height) {
    try {
        //Here we set the size of the Display then create it
        Display.setDisplayMode(new DisplayMode(width,height));
        Display.create();
    } catch (LWJGLException e) {

        e.printStackTrace();
    }

    // init OpenGL here

    while (!Display.isCloseRequested()) {

        // render OpenGL here

        Display.update();
    }

    Display.destroy();
    }


public static void main(String[] argv) {
    //Make a debug thing
    Debug debug = new Debug();

    debug.debug("Works");

    //Making an instance?
    DisplayMethod displayExample = new DisplayMethod();

    //Starting
    displayExample.createDisplay(100,100);
}

}

但无论我是否添加本机文件,它总是会引发相同的错误。

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
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 tools.crystalcoffee.methods.DisplayMethod.createDisplay(DisplayMethod.java:11)
at tools.crystalcoffee.methods.DisplayMethod.main(DisplayMethod.java:38)

我到处寻找答案,连续 2 小时,这就是它所抛出的全部。帮忙?

【问题讨论】:

  • 您是否正在尝试从 32 位 Elipse/JVM 加载 64 位库?请记住,文件必须命名为liblwjgl.so,而不是liblwjgl64.so
  • @Andreas 我有。它被称为 liblwjgl.so,它没有改变任何东西,它仍然说同样的事情。
  • 本机文件是否链接到项目属性 > 构建路径 > 库中的 LWJGL 库?
  • @TheDeadCrafter 该程序适合我。您是否尝试链接 lwjgl 2.9 库?如果您混合使用 v2 和 v3 库或不包含本地库,则可能会出现此错误。如果对您不起作用,请尝试阅读我的答案并发表评论。我让它在 eclipse 中为我工作并且窗口打开了。其实挺好看的。

标签: java eclipse lwjgl


【解决方案1】:

检查lwjgl 的属性。我试过你的程序,首先我得到了同样的错误(不满意的链接)。然后,如果我确保所有库都是 lwjgl 2.9.3(从 legacy.lwjgl 获取),那么它可以工作并且显示开始渲染。

我们遇到的例外似乎是因为我们有 lwjgl 3 和 2 的混合版本。

另见LWJGL Display class can't be found

还有Getting 'java.lang.UnsatisfiedLinkError': no lwjgl in java.library.path

【讨论】:

    【解决方案2】:

    我在其他地方找到了这个,这一切都对我有用:

    System.setProperty("org.lwjgl.librarypath", new File("/home/cole/Documents/lwjgl-2.9/lwjgl-2.9.0/native/linux").getAbsolutePath());
    

    【讨论】:

      猜你喜欢
      • 2017-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-27
      相关资源
      最近更新 更多