Hello Guest

Cannot load lwjgl.dll when running from JNLP

  • 1 Replies
  • 99 Views
Cannot load lwjgl.dll when running from JNLP
« on: July 13, 2019, 10:39:45 »
Hi,

First of all, i know that Java Web Start was removed from JDK but there are alternatives that we will use instead.

I'm trying to run libGDX from the JWS. I added all needed classes and native libraries to a single signed jar file. The gdx.dll is being correctly found, but it then breaks on lwjgl.dll. The reason and the partial solution is described here:

http://forum.lwjgl.org/index.php?topic=6612.0

This is the stack trace:

Code: [Select]
JNLPClassLoader: Finding library lwjgl.dll
JNLPClassLoader: Finding library lwjgl64.dll
[LwjglApplication] Couldn't initialize audio, disabling audio
java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.lwjgl.Sys$1.run(Sys.java:72)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:96)
at org.lwjgl.Sys.<clinit>(Sys.java:117)
at org.lwjgl.openal.AL.<clinit>(AL.java:59)
at com.badlogic.gdx.backends.lwjgl.audio.OpenALAudio.<init>(OpenALAudio.java:72)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:90)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:71)
at com.u.desktop.DesktopLauncher.<init>(DesktopLauncher.java:59)
at sup.library.gui.desktop.DesktopLauncher.<init>(DesktopLauncher.java:14)
at sup.library.gui.desktop.DesktopLauncher.main(DesktopLauncher.java:9)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Looking at org.lwjgl.Sys, it uses System.loadLibrary(lib_name). The thread i mentioned said that: "Library.class.getResource("lwjgl.dll") returns null, while Library.class.getClassLoader().getResource("lwjgl.dll") does return the dll Resource."

So i tried these two options when starting my app and got this:

Code: [Select]
      System.out.println("1: "+DesktopLauncher.class.getResource("lwjgl.dll"));
      System.out.println("2: "+DesktopLauncher.class.getClassLoader().getResource("lwjgl.dll"));

Result:

Code: [Select]
   1: null
   2: jar:file:/G:/desktop/build/jnlp/lib/core_java_sign.jar!/lwjgl.dll

Can this be fixed?

thanks

    guich

Ps: this is my launch.jnlp file:

Code: [Select]
<?xml version='1.0' encoding='UTF-8'?>
<jnlp spec='7.0' href='launch.jnlp' version='1.0'>
  <information>
    <title>desktop</title>
    <vendor>mClient</vendor>
  </information>
  <security>
    <all-permissions />
  </security>
  <resources>
    <j2se version='1.8' />
    <jar href='lib/core_java_sign.jar' />
    <nativelib href='lib/core_java_sign.jar' />
  </resources>
  <application-desc main-class='sup.library.gui.desktop.DesktopLauncher'>
    <argument>-verbose</argument>
  </application-desc>
</jnlp>

*

Offline spasi

  • *****
  • 2156
    • WebHotelier
Re: Cannot load lwjgl.dll when running from JNLP
« Reply #1 on: July 13, 2019, 12:18:01 »
Based on org.lwjgl.Sys, it sounds like you're on lwjgl2 which is no longer supported. Migrating to lwjgl3 is recommended. It has a more flexible and robust mechanism for loading shared libraries.