org.lwjgl.system.Library error

后端 未结 1 915
臣服心动
臣服心动 2021-01-03 06:39

I set up LWJGL 3 in Eclipse, and it\'s giving me this error when I try to run the test code from https://www.lwjgl.org/guide:

Exception in thread \"main\" ja         


        
相关标签:
1条回答
  • 2021-01-03 07:22

    You're missing the native libraries.

    As described in this link https://www.lwjgl.org/guide you'll have to setup java.library.path to the native library location.

    I downloaded the library and copied the HelloWorld code in the above link in HelloWorld.java inside the directory where I extracted the library.

    So the contents inside looks like below

    /HelloWorld.java
    /build.txt
    /doc
    /jar
    /native
    /src.zip
    

    I compiled and ran the HelloWorld.java as below

    Compilation (Path separator on linux would be : so there it would be -classpath jar/*:.)

    javac -classpath jar/*;. HelloWorld.java
    

    Run

    java -classpath jar/*;. -Djava.library.path=native HelloWorld
    

    And this works.

    Edit*

    I downloaded the library from https://www.lwjgl.org/download (Download Release.)

    In eclipse you can add the native library to your path by simply including it on source path. Like below:

    There's one more way using which native library can be added per Jar basis.

    Expand lwjgl.jar in build path > select native path > click on edit > click workspace > select native directory.

    See the images below

    0 讨论(0)
提交回复
热议问题