2

I am getting this error + >

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.lwjgl.Sys$1.run(Sys.java:73)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
    at org.lwjgl.Sys.loadLibrary(Sys.java:95)
    at org.lwjgl.Sys.<clinit>(Sys.java:112)
    at org.lwjgl.openal.AL.<clinit>(AL.java:59)
    at org.newdawn.slick.openal.SoundStore$1.run(SoundStore.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.newdawn.slick.openal.SoundStore.init(SoundStore.java:292)
    at org.newdawn.slick.Music.<init>(Music.java:128)
    at org.newdawn.slick.Music.<init>(Music.java:74)
    at com.meteor.breaker.AudioPlayer.load(AudioPlayer.java:21)
    at com.meteor.breaker.Game.<init>(Game.java:35)
    at com.meteor.breaker.Game.main(Game.java:55)
C:\Users\Hardi\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)

I have searched this for a day and couldn't find any working solutions.

I am using lwjgl and it's native libraries are in path

"F:\Khushit Java\Meteor Breaker\lib\windows"

In the windows folder lwjgl.dll is present.

I get over to a VM option:- which was to write

-Djava.library.path="F:\Khushit Java\Meteor Breaker\lib\windows"

This works for running it on ide. but it is not working when i run the jars.

So , I come up with a solution :- to load libraries runtime:-

System.setProperty("java.library.path",<path>);

   static{
                     File l = new File("lib/windows");
                    System.setProperty("java.library.path",l.getAbsolutePath());
                    System.out.println("static:" + System.getProperty("java.library.path"));

                }

Here the real problem comes

if I print System.getProperty("java.library.path") with vm(First method) option I get path :

F:\Khushit Java\Meteor Breaker\lib\windows

and if I print System.getProperty("java.library.path") with runtime linking(second method) I also get the same path:

F:\Khushit Java\Meteor Breaker\lib\windows

Which just means that java.library.path is okay then also i am having the error.

E_net4
  • 27,810
  • 13
  • 101
  • 139
  • 1
    I had already ho through this :-'( but didn't get the solution @SumeshTG how can I do this with netbeans because i can't find a native lib option in netbeans –  Aug 14 '18 at 10:29
  • Add your libs in relative path. – Sumesh TG Aug 14 '18 at 10:30
  • 1
    Didnt work either i just tried System.setProperty("java.library.path","lib/windows"); –  Aug 14 '18 at 10:32
  • No need to set `java.library.path` this path will stored in system enviroment varieble – Sumesh TG Aug 14 '18 at 10:33
  • 1
    I think i got a solution from link specified by @SumeshTG https://stackoverflow.com/questions/6588799/when-i-run-the-jar-i-get-a-no-lwjgl-in-java-library-path-error?rq=1 Still not completely sure. so not closing the question :-) –  Aug 14 '18 at 10:35
  • Try this `Project Properties -> Libraries -> Add JAR/Folder`, and in that dialog there is a "`Reference as"` option. Choose `"Relative Path"` and then locate your library – Sumesh TG Aug 14 '18 at 10:36
  • Do you have the right kind of library on the path? For a 32bit JVM you need a 32bit library. For a 64 bit JVM you need a 64bit library. – Stephen C Aug 14 '18 at 11:13
  • 1
    how can i close the question : I got solution it is http://ninjacave.com/jarsplice JARSPLISE –  Aug 15 '18 at 11:05

0 Answers0