[SOLVED] Exception: Could not locate OpenAL library

This isn’t going to be very helpful but may help narrow something down.

Old time lore used to have it that some systems would get this error when the headphones were plugged in. I mention it partially in the slight chance that it’s directly relevant but also to highlight that it may be related to the sound source the is selected, etc…

It might be worth monkeying around in the sound settings for your desktop to see if anything changes the results in a meaningful way.

Obviously, the status quo is not really acceptable long term even if you find a work-around… but the work-around and/or additional information might be helpful. One more layer of the onion, so to speak. (Obligatory: “Why can’t Ogres be like a parfait?!? Everybody likes a parfait…”)

The OP mentioned they were using Windows, and I’ve never had the issue on Windows - but it might be headphone-related there.

I’ve got it working on many various nix distributions (mint, manjaro, ubuntu vanilla, etc) so it’s probably something silly. I’ll see if I can find the cause. It would be interesting to know if nothing else.

I have the following problem. I will probably write a book about gaming with Java (the publisher has not yet agreed). And then I want to introduce jME. So I need a work round that will help the reader get around this problem. I thought a different sound card would be the solution, but unfortunately it is not. And I don’t use headphones :wink:

If it is of any help, I always get this exception when I have no audio output device plugged in (100% reproducibility). It also never happens for me if an audio output device is plugged. I’m using Windows 10.
I ‘fixed’ this with settings.setAudioRenderer(null) since my game has no audio yet, but long term I would also be interested in fixing this properly.

I have had this issue on a VM where there was no audio card attached to the VM. I traced it down to a issue where if the computer (VM or physical) does not have a audio output channel, then this error will occur. I do not know if this is the same cause for you, but it is something I have run into.

Possibly related:

Heres one you missed.

May be relevant.

Reading the history of this issue, many “solutions” have been reported: headphones, software updates, reinstalls, etcetera. My guess is that there’s a race condition that’s sensitive to many factors.

If I could consistently reproduce the issue, the first thing I’d try would be to catch the exception, wait half a second, and retry the OpenAL operation that’s failing.


This issue often affects my jME applications using both the LWJGL2 & 3 backends.

However, I never have this issue with plain LWJGL3 apps.

When you say LWJGL 2 & 3 do you mean applications where both libs are present and can be chosen between at runtime, or where LWJGL 2 is used for one thing (say, audio), and LWJGL 3 another (such as rendering) (I.e, both are loaded and active at the same time)?

I read it as JME apps with either 2 or 3 exhibit the issue but regular non-JME apps that use lwjgl3 are fine.

…which would lend some credence to the “strange timing” hypothesis.

1 Like

What @pspeed said

1 Like

I tried this work around. Create a java project and edit the file LwjglAbstractDisplay.java. Go to line 211 in the run method. Add the following lines:

    while(true) {
        try {
            if (!initInThread()) {
                logger.log(Level.SEVERE, "Display initialization failed. Cannot continue.");
        } catch (Exception ex) {
            System.out.println("LwjglAbstractDisplay: initInThread() call new.");
            try { Thread.sleep(1000); } catch (Exception ex2) {}

create a new library: jme3-lwjgl-3.2.1-stable.jar.
if an exception occurs, the output looks like this:

Jul 26, 2020 11:12:08 AM com.jme3.asset.AssetConfig loadText
WARNUNG: 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
LwjglAbstractDisplay: initInThread() call new.
Jul 26, 2020 11:12:09 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo

Thanks for your help :slight_smile:

1 Like

The exception is thrown from main.start() - restarting the context or application results in the same failure. Setting the appSettings to showSettings true/false doesn’t make any difference either. Trying as hard as I can to ensure the window is focused doesn’t make any difference - or I just can’t physically do it quick enough.

The only information I have really to go on after reading through the data in this post is that

  • it may be a race condition
  • the sound card is “busy”.

For the second point - does that mean that no spare channels are available? It requires exclusive access and can’t obtain it? I’m not sure exactly what “busy” means. It exists (I have a sound card). It works (in any other application). I have been listening to youtube/watching videos and run a JME app previously with no issues - so it shouldn’t require “exclusive” access.

I’m still none the wiser at this point.

I think maybe it wasn’t 100% clear from your post. Did the work around work?

1 Like

yes, the work around works very well. This solves my problem.

1 Like

Note: for a real solution, we probably want to limit the number of times that it loops.

1 Like

I agree.

I’ve opened issue 1383 to track the fix.


Same problem here with an Ubuntu 20.04 machine. The issue was solved following instructions on this URL:

1 Like

I’ve implemented a workaround for LWJGL v2 in an “sgold-issue-1383” branch at https://github.com/stephengold/jmonkeyengine/tree/sgold-issue-1383

Before submitting a PR, I’d like to implement a similar fix for LWJGL v3. To do so, I need to see a stack trace from a failing run with LWJGL v3. I looked through past discussions and didn’t find one. Can anyone provide a stack trace for this issue with LWJGL v3?

1 Like