[SOLVED] LWJGL Classpath - Native Libraries

Started by shivshank, December 07, 2014, 20:32:25

Previous topic - Next topic

shivshank

I got this to launch my jar:
java -cp gameEngine.jar;lib/lwjgl.jar main.EngineLauncher

It successfully finds lwjgl.jar, but now I don't know how to point Java to the natives. Adding lib/natives/lwjgl.dll doesn't seem to work. Do I need to do this through code and not command line?

I just get an "UnsatisfiedLinkError: No lwjgl in java.library.path".
lib/
    natives/
        lwjgl.dll
    lwjgl.jar

Above is my directory structure. How do I add the lwjgl.dll native to the classpath? The following doesn't work:
java -cp gameEngine.jar;lib/lwjgl.jar;lib/natives/lwjgl.dll gameEngine.jar

shivshank

Oh, I figured it out.

This worked:
java -cp lib/lwjgl.jar;JVA_GameProject.jar -Djava.library.path="lib/natives" main.EngineLauncher

Classpath is for Java Classes (that much I had started to guess, if it wasn't immediately obvious) and java.library.path is for Native Libraries, it appears. The other problem I had had was that I was writing "lib/natives/lwjgl.dll" instead of just the directory; hence why eclipse always only asked for the directory...