JOAL with JNLPAppletLauncher

Using JOAL with the JNLPAppletLauncher does not work, I get the following exception if wrap_oal.dll and OpenAL32.dll are absent from the c:\windows\system32 folder :

java.lang.RuntimeException: Can not get proc address for method “alcCaptureCloseDevice”: Couldn’t set value of field “_addressof_alcCaptureCloseDevice” in class net.java.games.joal.impl.ALCProcAddressTable
at com.sun.gluegen.runtime.ProcAddressHelper.resetProcAddressTable(ProcAddressHelper.java:68)
at net.java.games.joal.impl.ALProcAddressLookup.resetALCProcAddressTable(ALProcAddressLookup.java:109)
at net.java.games.joal.impl.ALCImpl.alcOpenDevice(ALCImpl.java:341)
at imiuzetna.audio.AudioContext.(Unknown Source)
at imiuzetna.video.Interface.(Unknown Source)
at imiuzetna.Imiuzetna.playScene(Unknown Source)
at auberge_emu.MainApplet.run(Unknown Source)
at imiuzetna.ImiuzetnaApplet$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Unable to find and load OpenAL library
at net.java.games.joal.impl.ALProcAddressLookup$DynamicLookup.dynamicLookupFunction(ALProcAddressLookup.java:66)
at com.sun.gluegen.runtime.ProcAddressHelper.resetProcAddressTable(ProcAddressHelper.java:64)
… 8 more

With wrap_oal.dll and OpenAL32.dll in the c:\windows\system32 folder, I have sound in the applet.
When launching the same app with Java webstart on the same computer, JOAL woks without problems.
I think JOAL worked with the JOGLAppletLauncher without the need of the two dlls in the system folder, maybe there’s some code from the JOGLAppletLauncher that is missing in the JNLPAppletLauncher.

Thanks for your help.

(I changed my account name as I realised it was available again)

I think the loading of OpenAL32.dll and wrap_oal.dll works on the JOGLAppletLauncher thanks to this code :

          if (haveJOAL) {
            // Turn off the System.loadLibrary call of the joal_native
            // library. It will still need to load the OpenAL library
            // internally via another mechanism.
            try {
              Class c = Class.forName("net.java.games.joal.impl.NativeLibLoader");
              c.getMethod("disableLoading", new Class[] {}).invoke(null, new Object[] {});
            } catch (Exception e) {
              e.printStackTrace();
            }

            // Append the installed native library directory to
            // java.library.path. This is the most convenient way to
            // make this directory available to the NativeLibrary code,
            // which needs it for loading OpenAL if present.
            String javaLibPath = System.getProperty("java.library.path");
            String absPath = nativeLibDir.getAbsolutePath();
            boolean shouldSet = false;
            if (javaLibPath == null) {
              javaLibPath = absPath;
              shouldSet = true;
            } else if (javaLibPath.indexOf(absPath) < 0) {
              javaLibPath = javaLibPath + File.pathSeparator + absPath;
              shouldSet = true;
            }
            if (shouldSet) {
              System.setProperty("java.library.path", javaLibPath);
            }

            // Load core JOAL native library
            loadLibrary(nativeLibDir, "joal_native");
          }

But the JNLPAppletLauncher does not extract the content of the joal-native-xxx.jar, so even if I add this code at the beginning of my app it will not work. Does anybody have an idea ?

OK i found a workaround for those interested in this issue. I have added the following code in the “extractNativeLibs” method from the JNLPAppletLauncher, juste before the “nativeLibMap.put(libName, nativeLib.getAbsolutePath());” line (code is borrowed from the JOGLAppletLauncher) :

                if(entryName.toLowerCase().equals("openal32.dll"))
                {
                    // Append the installed native library directory to
                    // java.library.path. This is the most convenient way to
                    // make this directory available to the NativeLibrary code,
                    // which needs it for loading OpenAL if present.
                    String javaLibPath = System.getProperty("java.library.path");
                    String absPath = nativeTmpDir.getAbsolutePath();
                    boolean shouldSet = false;
                    if (javaLibPath == null) {
                      javaLibPath = absPath;
                      shouldSet = true;
                    } else if (javaLibPath.indexOf(absPath) < 0) {
                      javaLibPath = javaLibPath + File.pathSeparator + absPath;
                      shouldSet = true;
                    }
                    if (shouldSet) {
                      System.setProperty("java.library.path", javaLibPath);
                    }
                    System.out.println(System.getProperty("java.library.path"));
                }