LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: imsomad on January 30, 2014, 11:14:20

Title: Yet another no lwjgl in java.library.path post
Post by: imsomad on January 30, 2014, 11:14:20
I just don't get it....
I'm using netbeans7.4 on a 64 bit win7 pc, i have an amd hd6670 that supports opengl. I've successfully added lwjgl libraries to my project but when i hit run this message pop up: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
I've tried setting the VM option to -Djava.library.path="my folder\lwjgl-2.9.1\native\windows" and it doesn't work, i've tried using
  System.setProperty( "java.library.path", "my folder\\lwjgl-2.9.1\\native\\windows;"+System.getProperties().getProperty("java.library.path")); 
and it doesn't work too.
I've heard that might be caused by the 64bit JVM. Do i really need to change to  32bit JVM or there is a solution?

(FYI i've searched 4 hours online before trying the good old i'm a n00b pls help me post)
Title: Re: Yet another no lwjgl in java.library.path post
Post by: Cornix on January 30, 2014, 11:49:57
It should always work when the natives are in the same folder as your jar.
If you want to put them in an other folder this solution works for me:
System.setProperty("java.library.path", path);
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
sysPathsField.setAccessible(true);
sysPathsField.set(null, null);

If you just set the "java.library.path" nothing will happen, you have to also reset the class loader. That is because the class loader caches the property internally.
Title: Re: Yet another no lwjgl in java.library.path post
Post by: Oebele on January 30, 2014, 12:00:35
I am using 64bit without problems, but that is on Linux (OpenJDK), so that can be different on windows, I don't know.

A little checklist:
- Are you really sure the path is correct?
- Have you tried specifying an absolute path?
- Have you tried to put the natives in the working directory, as Cornix suggested?
- Have you printed the java.library.path settings?

Quite obvious hints, so I don't think I'll be of any use, but just in case...
Title: Re: Yet another no lwjgl in java.library.path post
Post by: imsomad on January 30, 2014, 12:22:34
@Cornix : Thank you for your code suggestion, now it works just fine :) !
@Oebele : It's always better to check one more time with this kind of things, thank you too!