Create only one AL instance

When TestAmbient is executed by TestChooser,

trying to create 2 AL instance and failed with error below.


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(

at sun.reflect.DelegatingMethodAccessorImpl.invoke(

at java.lang.reflect.Method.invoke(

at jme3test.TestChooser$


Caused by: java.lang.IllegalStateException: Only one OpenAL context may be instantiated at any one time.

at org.lwjgl.openal.AL.create(

at org.lwjgl.openal.AL.create(

at org.lwjgl.openal.AL.create(






Index: src/lwjgl-oal/com/jme3/audio/lwjgl/


— src/lwjgl-oal/com/jme3/audio/lwjgl/ (revision 6302)

+++ src/lwjgl-oal/com/jme3/audio/lwjgl/ (working copy)

@@ -94,7 +94,9 @@

public void initialize(){


  •        AL.create();<br />
  •        if (!AL.isCreated()) {<br />
  •            AL.create();<br />
  •        }<br />

}catch (OpenALException ex){

logger.log(Level.SEVERE, "Failed to load audio library", ex);

audioDisabled = true;


The library / dll for openal (the sound) can only be used by one process at a time. It seems as if you are running this from the same directory more than once, thus causing the problem. I’m not a JME expert but if theory you should be able to build this project, copy it to another folder. Then build /run the project for one instance, then just run the jar from the copied folder as the other instance.


After rereading, it looks like you are only trying to run the one instance but getting an error. Sorry that wasn’t clear to me right away, it is still early ;). You might already have a previous example open in memory that is using the sound resource. Try killing javaw.exe or if you are using another OS killing the java processes, then start again.

Thank you for the answer. :smiley:

As you said, this approach seems to be inappropriate if there should be only one AudioRenderer.

There is no other java processes because executing TestAmbient class directly causes no problem.

I need to find why TestChooser calls the method twice.