[SOLVED] Exception: Could not locate OpenAL library

First I used my onboard soundcard “Realtek High Definition Audio”. And I got this Error very often. Sometimes I had to start a program 10 times or more.

Now I have installed the “Creative Sound Blaster Audigy Fx” soundcard. I have deactivated the NVIDIA audio and the Realtec audio.

But the Error still occur.

What else can I do?

I use Windows 10.

1 Like

Without seeing the stack trace, it’s difficult to know what’s occurring.

The OpenAL native library for Windows is included in the jme3-lwjgl and jme3-lwjgl3 libraries. Which of those libraries does your project use?

Before the native library can be loaded, it must be unpacked into the current directory. Is the current directory writable by the application? Is a file named “OpenAL32.dll” or “OpenAL64.dll” or “OpenAL.dll” present after the crash?

OpenAL is for sound, which many apps don’t need. It’s possible to disable sound using AppSettings. This might help you avoid the issue, whatever it is:

    boolean loadDefaults = true;
    AppSettings settings = new AppSettings(loadDefaults);
    settings.setAudioRenderer(null);
    Application application = new MyGame();
    application.setSettings(settings);
    application.start();
1 Like

Thank You for Your hint, sgold.

In the project folder is the dll: OpenAL64.dll

My project uses the jme3-lwjgl library.

Thank You for Your code snippet. But my app uses Audio.

Here is the stack trace:
SCHWERWIEGEND (serious): 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:748)
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

1 Like

Try deleting it. It may be corrupt for some reason or another and just throwing a generic error.

I have deleted the OpenAL64.dll in the project folder. Starting my app a few times, the same exception occurs. (The IDE replaced the dll.). I use jME 3.2, is that the problem?

Do you mean it works a few times then fails, or that it fails every time?

it works a few times then fails.

Sometimes I have to start the app 10 times or more to run it. Sometimes I can run it 3 times or more without this error. In another app I use Nifty. This app has this problem rarely.

I have the same issue, and I can’t seem to detect why it’s happening. I’m using Kubuntu 20.04 fully updated. Audio works as intended on any other application (VLC, browsers, games).

I’ve tried:

  • LWJGL and LWJGL3
  • Java 8 and 11
  • 3.2.0-stable, 3.2.1-stable, 3.2.2-stable, 3.2.3-stable

This is my gradle.build file. Super minimal. Literally the minimum required for JME to run on desktop.

plugins {
    id 'java'
    id 'application'
}

group 'com.jayfella'
version '0.0.1'

mainClassName = "com.jayfella.animalia.Main"

repositories {
    jcenter()
}

project.ext {
    jme_version = "3.2.3-stable"
}

dependencies {

    implementation "org.jmonkeyengine:jme3-core:$jme_version"
    implementation "org.jmonkeyengine:jme3-desktop:$jme_version"
    implementation "org.jmonkeyengine:jme3-lwjgl:$jme_version"

}

This is a minimal class - again - the minimum required to start the JME application.

package com.jayfella.animalia;

import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AppState;
import com.jme3.system.AppSettings;

public class Main extends SimpleApplication {

    public static void main(String... args) {

        Main main = new Main();
        main.start();
    }

    @Override
    public void simpleInitApp() {

    }

}

This is the entire log output.

13:13:31: Executing task 'run'...

Starting Gradle Daemon...
Connected to the target VM, address: '127.0.0.1:46099', transport: 'socket'
Gradle Daemon started in 681 ms
> Task :compileJava
Connected to the VM started by ':run' (localhost:35137). Open the debugger session tab
> Task :processResources NO-SOURCE
> Task :classes

> Task :run
Jul 25, 2020 1:13:36 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.2-stable
 * Branch: HEAD
 * Git Hash: e2245aa
 * Build Date: 2019-03-18
Jul 25, 2020 1:13:37 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.3 context running on thread jME3 Main
 * Graphics Adapter: null
 * Driver Version: null
 * Scaling Factor: 1
Jul 25, 2020 1:13:37 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: GeForce GTX 1060 3GB/PCIe/SSE2
 * OpenGL Version: 4.6.0 NVIDIA 440.100
 * GLSL Version: 4.60 NVIDIA
 * Profile: Compatibility
Jul 25, 2020 1:13:37 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.MeshLoader
Jul 25, 2020 1:13:37 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.SkeletonLoader
Jul 25, 2020 1:13:37 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.MaterialLoader
Jul 25, 2020 1:13:37 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.SceneLoader
Jul 25, 2020 1:13:37 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
Jul 25, 2020 1:13:37 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.fbx.FbxLoader
Jul 25, 2020 1:13:37 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.gltf.GltfLoader
Jul 25, 2020 1:13:37 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.gltf.BinLoader
Jul 25, 2020 1:13:37 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.gltf.GlbLoader
Jul 25, 2020 1:13:37 PM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.audio.plugins.OGGLoader
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) alsa_open_playback: Could not open playback device 'default': Device or resource busy
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) alsa_open_playback: Could not open playback device 'default': Device or resource busy
Jul 25, 2020 1:15:26 PM 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:602)
	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:748)
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


BUILD SUCCESSFUL in 1m 58s
2 actionable tasks: 2 executed
13:15:30: Task execution finished 'run'.
Disconnected from the target VM, address: '127.0.0.1:46099', transport: 'socket'

So I did a little bit of tracing myself and I noticed an error during the sound initialization phase that may or may not mean something.

Notice the variables in the lower-right window indicating an error occurred. Googling doesn’t seem to reveal anything of use. As stated, though, I have tried Java 1.8 and 11 to see if it yielded any difference - which it didn’t.

And a little further down the lines of code in the same method is where the origin of the exception is thrown.

I noticed the log weren’t being displayed so I configured a logger, which yielded more information.

13:26:06: Executing task 'run'...

> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes

> Task :run
25 Jul 2020 13:26:08 [ INFO | JmeSystem ] Running on jMonkeyEngine 3.2-stable
 * Branch: HEAD
 * Git Hash: e2245aa
 * Build Date: 2019-03-18
25 Jul 2020 13:26:09 [ INFO | LwjglContext ] LWJGL 2.9.3 context running on thread jME3 Main
 * Graphics Adapter: null
 * Driver Version: null
 * Scaling Factor: 1
25 Jul 2020 13:26:09 [ INFO | GLRenderer ] OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: GeForce GTX 1060 3GB/PCIe/SSE2
 * OpenGL Version: 4.6.0 NVIDIA 440.100
 * GLSL Version: 4.60 NVIDIA
 * Profile: Compatibility
25 Jul 2020 13:26:09 [ WARN | AssetConfig ] Cannot find loader com.jme3.scene.plugins.ogre.MeshLoader
25 Jul 2020 13:26:09 [ WARN | AssetConfig ] Cannot find loader com.jme3.scene.plugins.ogre.SkeletonLoader
25 Jul 2020 13:26:09 [ WARN | AssetConfig ] Cannot find loader com.jme3.scene.plugins.ogre.MaterialLoader
25 Jul 2020 13:26:09 [ WARN | AssetConfig ] Cannot find loader com.jme3.scene.plugins.ogre.SceneLoader
25 Jul 2020 13:26:09 [ WARN | AssetConfig ] Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
25 Jul 2020 13:26:09 [ WARN | AssetConfig ] Cannot find loader com.jme3.scene.plugins.fbx.FbxLoader
25 Jul 2020 13:26:09 [ WARN | AssetConfig ] Cannot find loader com.jme3.scene.plugins.gltf.GltfLoader
25 Jul 2020 13:26:09 [ WARN | AssetConfig ] Cannot find loader com.jme3.scene.plugins.gltf.BinLoader
25 Jul 2020 13:26:09 [ WARN | AssetConfig ] Cannot find loader com.jme3.scene.plugins.gltf.GlbLoader
25 Jul 2020 13:26:09 [ WARN | AssetConfig ] Cannot find loader com.jme3.audio.plugins.OGGLoader
25 Jul 2020 13:26:09 [ ERROR | LegacyApplication ] 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:602)
	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:748)
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
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) alsa_open_playback: Could not open playback device 'default': Device or resource busy
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) alsa_open_playback: Could not open playback device 'default': Device or resource busy

BUILD SUCCESSFUL in 5s
2 actionable tasks: 2 executed
13:26:12: Task execution finished 'run'.

If there’s any more information I can provide please do let me know. As it stands right now I must the the AudioRenderer to null in order to get the JME application to start.

1 Like

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.

2 Likes

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