Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  JOAL with JNLPAppletLauncher  (Read 2569 times)
0 Members and 1 Guest are viewing this topic.
Agrv2236
Guest
« Posted 2008-06-06 17:41:31 »

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.<init>(Unknown Source)
   at imiuzetna.video.Interface.<init>(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.
Offline Agrv

Junior Newbie





« Reply #1 - Posted 2008-06-09 11:12:30 »

(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 :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
          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 ?
Offline Agrv

Junior Newbie





« Reply #2 - Posted 2008-06-09 14:18:28 »

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) :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
                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"));
                }
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (36 views)
2014-07-24 01:59:36

Riven (37 views)
2014-07-23 21:16:32

Riven (25 views)
2014-07-23 21:07:15

Riven (27 views)
2014-07-23 20:56:16

ctomni231 (57 views)
2014-07-18 06:55:21

Zero Volt (49 views)
2014-07-17 23:47:54

danieldean (39 views)
2014-07-17 23:41:23

MustardPeter (43 views)
2014-07-16 23:30:00

Cero (59 views)
2014-07-16 00:42:17

Riven (56 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!