Java - Library path error

后端 未结 4 828
野趣味
野趣味 2021-01-06 05:39

I\'m trying to start my java game but I have some troubles with the java command line:

Here is what I type:

C:\\>java -Djava.library.path=%cd%\\lib

4条回答
  •  北海茫月
    2021-01-06 06:41

    This because lwjgl library is made by two components:

    • the .jar file which contains Java code
    • and the native binary library (which can be .so or .dll or .dylib according to your OS)

    The first error you are getting is because you are setting the library path, that should contain the native library, but it does contain the .jar. So you get a java.lang.NoClassDefFoundError because you should set either the library path to the folder that contains native library, either the classpath to contain the real lwjgl.jar file.

    The second error that you get with Eclipse is a successive step: your classpath contains the jar library but it is not able to find the native library attached to it, you can fix it in the following way:

    enter image description here

提交回复
热议问题