Occasionally occurring "Could not locate OpenAL library"

I am a beginner in JME3 and have so far been able to make some simple applications, but frequently I get an uncaught exception due to “Could not locate OpenAL library”. I searched this problem in the forum and it looks like everyone else who has this problem keeps getting it systematically every time they run their game. But I can get rid of this without any modifications to the project: I just close and restart the IDE and run again, and then everything works fine. In other words, the problem is not reproducible but happens quite often. I am using Windows 10 and I also have gotten the same problem with my Windows 7 machine. The runtime exception is coming from com.jme3.audio, even though I am not using audio and my code has no imports from com.jme3.audio. Just in case, at the end of this post I also pasted the content of the Output/Application pane that has my audio renderer information.

run:
huhtikuuta 28, 2017 2:58:07 IP. java.util.prefs.WindowsPreferences
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(…) returned error code 5.
huhtikuuta 28, 2017 2:58:09 IP. com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.1-stable

  • Branch: HEAD
  • Git Hash: af04bf9
  • Build Date: 2017-02-19
    huhtikuuta 28, 2017 2:58:10 IP. com.jme3.system.lwjgl.LwjglContext printContextInitInfo
    INFO: LWJGL 2.9.3 context running on thread jME3 Main
  • Graphics Adapter: aticfx64
  • Driver Version: 8.17.10.1474
  • Scaling Factor: 1
    huhtikuuta 28, 2017 2:58:10 IP. com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
    INFO: OpenGL Renderer Information
  • Vendor: ATI Technologies Inc.
  • Renderer: AMD Radeon™ R4 Graphics
  • OpenGL Version: 4.5.13447 Compatibility Profile Context 16.300.2701.0
  • GLSL Version: 4.50
  • Profile: Compatibility
    huhtikuuta 28, 2017 2:58:10 IP. com.jme3.asset.AssetConfig loadText
    WARNING: Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
    AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80004005
    AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80004005
    AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80004005
    huhtikuuta 28, 2017 2:58:10 IP. com.jme3.app.LegacyApplication handleError
    SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
    java.lang.RuntimeException: org.lwjgl.LWJGLException: Could not locate OpenAL library.
    at com.jme3.audio.lwjgl.LwjglALC.createALC(LwjglALC.java:17)
    at com.jme3.audio.openal.ALAudioRenderer.initOpenAL(ALAudioRenderer.java:95)
    at com.jme3.audio.openal.ALAudioRenderer.initialize(ALAudioRenderer.java:225)
    at com.jme3.app.LegacyApplication.initAudio(LegacyApplication.java:283)
    at com.jme3.app.LegacyApplication.initialize(LegacyApplication.java:603)
    at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:178)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: org.lwjgl.LWJGLException: Could not locate OpenAL library.
    at org.lwjgl.openal.AL.create(AL.java:156)
    at org.lwjgl.openal.AL.create(AL.java:102)
    at org.lwjgl.openal.AL.create(AL.java:206)
    at com.jme3.audio.lwjgl.LwjglALC.createALC(LwjglALC.java:15)
    … 8 more

Running on jMonkeyEngine 3.1-stable

  • Branch: HEAD
  • Git Hash: af04bf9
  • Build Date: 2017-02-19
    LWJGL 2.9.3 context running on thread jME3 Main
  • Graphics Adapter: aticfx64
  • Driver Version: 8.17.10.1474
  • Scaling Factor: 1
    OpenGL Renderer Information
  • Vendor: ATI Technologies Inc.
  • Renderer: AMD Radeon™ R4 Graphics
  • OpenGL Version: 4.5.13447 Compatibility Profile Context 16.300.2701.0
  • GLSL Version: 4.50
  • Profile: Compatibility
    Audio Renderer Information
  • Device: OpenAL Soft
  • Vendor: OpenAL Community
  • Renderer: OpenAL Soft
  • Version: 1.1 ALSOFT 1.15.1
  • Supported channels: 64
  • ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
  • AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
    Pausing audio device not supported.
    Audio effect extension version: 1.0
    Audio max auxiliary sends: 4
    Returning hash code of content
    Reading welcome page content from web failed!
    wiki.jmonkeyengine.org
    Checking page id 0 vs stored id 0
    Error in assetpack, could not load assetpack.xml!

Where are you executing the game?
Technically the OpenAL.dll is extracted from the jar files.
Do you see this file? If not it might be a permission problem

This however seems like the Audio Lib could not access your audio card, which is more of an openAL general thing. Do you have any special sound cards?

Related:

I am executing the game from the IDE: I just right click Main.java and run. In the folder that has my game there is no OpenAL.dll. However, there is OpenAL64.dll.
Regarding sound cards, my default device is Realtek High Definition Audio and then there also is a AMD High Definition Audio Device.
When I run the HelloAudio.java it seems to work fine and I hear the ocean waves and gunshots.

Sometimes it just helps to clean and build your game. To do so just right-click your project and click “Clean and Build”.

2 Likes

Well, after you posted this solution, I got the problem once and I tried your solution and it worked. So far so good. It is not a reproducible problem, so lets see if this will work every time. In case someone else gets this kind of problem, I will try to remember to post in a week or so to confirm if this solution works every time.

1 Like

Glad that helps. I am also wondering if this can fix that problem every time but also I’d like to know where this problem comes from…

I think @jayfella’s link isn’t that related since I also get that Registry Exception, I guess every program gets that since Vista (where you need admin permissions for the registry).

What I want to say: I get that Exception every start but it is only a warning (I guess saving won’t work)

Yeah, at work our project uses the GWT preprocessor thing… and it outputs that error every time we build. It’s lovely. :chimpanzee_nogood:

Now it has been a few days, so here is how the clean and build solution worked in the long run: I got the error a number of times on my Windows 10 machine and every the clean and build worked - once I had to clean and build a second time. It is much more convenient than having to restart the IDE. (This is a error rather than a warning in the sense that it is not possible to run the game without fixing this.)

I recently exported as zip and imported onto my Windows 7 machine and I have been working on it a lot the last 2 days without ever getting this problem, although last week I got it a few times on my Windows 7 machine as well.

My observation: unable to say what is going on but clean and build has always worked so far.

1 Like

I had this problem myself. It looks like the audio renderer option gets reset when the settings menu is shown to the user or player. If you set your app to not show the settings dialog (app.setShowSetting(false)), your audio renderer option should persist.