Pointing to librarys out of java

Anyone some idea why I couldn’t include my jogl librarys without pointing to them from the shell with

java -Djava.library.path=./my_game_dir/libs/ -cp .... (if I did it that way it works)

I tried to insert

System.setProperty("java.library.path","./my_game_dir/libs/");

in my javasources, it’s one of the first lines in my main(), but anyway I got an error:

java.lang.UnsatisfiedLinkError: no jogl in java.library.path

Is it just impossible to “declare” the librarys (jogl.dll etc) or is there some error in my code?

Edit:
I tried the same thing for jinput:

System.setProperty("jinput.controllerPluginPath", "./my_game_dir/libs/");

and the javaprog finds the jinput librarys

I think the boot classloader captures the contents of java.library.path early during JVM initialization and ignores later changes to it. I have found that the most convenient way to both develop with and use JOGL is to add the library directories to the PATH environment variable (on Windows) and to the LD_LIBRARY_PATH environment variable (on Unix). Java Web Start can then override those settings.

Thx, I thought something like that

Immo I just use some different batchfiles for Windows and Linux, with different -Djava.library.path= settings, works for me, but as you said, webstart would be great, I’ll put it on my todo list :slight_smile:

You can also set the LD_LIBRARY_PATH so you don’t have to use the -D option. You can set this in windows by right clicking on the “My Computer” icon and click on properties. Somewhere in there you will see “set environment variables”. In there, set LD_LIBRARY_PATH to the directory where the native JNI files are.