Crash upon startup of simple application audio class missing

Upon starting up a baseline SimpleApplication, my process is halted with this error.

SEVERE: CRITICAL ERROR: Audio implementation class is missing!
Make sure jme3_lwjgl-oal or jm3_joal is on the classpath.
java.lang.ClassNotFoundException: com.jme3.audio.joal.JoalAL
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:292)
at com.jme3.system.JmeDesktopSystem.newObject(JmeDesktopSystem.java:297)
at com.jme3.system.JmeDesktopSystem.newAudioRenderer(JmeDesktopSystem.java:323)
at com.jme3.system.JmeSystem.newAudioRenderer(JmeSystem.java:167)
at com.jme3.app.LegacyApplication.initAudio(LegacyApplication.java:282)
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.base/java.lang.Thread.run(Thread.java:844)

My application has nothing in it’s constructor, and my main method is new MyGame().start();

I am using gradle to resolve my dependenies and my build.gradle looks like this

group ‘mcclean.jetpack’
version ‘1.0-SNAPSHOT’

apply plugin: ‘java’

def jme3 = [v: ‘3.2.1-stable’, g: ‘org.jmonkeyengine’]

repositories {
mavenCentral()
jcenter()
}

//JME Dependencies
dependencies {
compile “${jme3.g}:jme3-core:${jme3.v}”
runtime “${jme3.g}:jme3-desktop:${jme3.v}”
runtime “${jme3.g}:jme3-lwjgl:${jme3.v}”
}

dependencies {
testCompile group: ‘junit’, name: ‘junit’, version: ‘4.12’
}

What is causing this crash? I believe that my dependency setup is enough, as referenced here. https://jmonkeyengine.github.io/wiki/jme3/maven.html

Edit: I’m using Intellij Community edition and macOS high sierra 10.13.3 if that helps.

Looks like the only difference between my sample application and yours is the runtime versus compile dependencies:

…you could try checking out that project and seeing if it runs.

Thanks, I’ve tried with both compile and runtime, but the error persists.

Perhaps your app settings are unusual. What is the value returned by

settings.getAudioRenderer()

?

Did you try the example?

Yes I tried the example but unfortunately the same error persists.

I’ve done some more debugging and I’ve found the following strange error. If in the constructor of my class that extends simpla application I call the method setShowSettings(false); The error dissapears. I went into the debugger mode and I found that during the following method the value of the settings mapping AudioRenderer is LWJGL before the if(showSettings) block is executed. After the block is executed, but before the start method exits, the audio renderer setting becomes JOGL.

Here is the start method of SimpleApplication for convenience:

public void start() {
// set some default settings in-case
// settings dialog is not shown
boolean loadSettings = false;
if (settings == null) {
setSettings(new AppSettings(true));
loadSettings = true;
}

    // show settings dialog
    if (showSettings) {
        if (!JmeSystem.showSettingsDialog(settings, loadSettings)) {
            return;
        }
    }
    //re-setting settings they can have been merged from the registry.
    setSettings(settings);
    super.start();
}

Then you must be loading old cached settings with jogl set. Maybe you ran an untitled app settings with jogl set one time?

I think the app settings title is the preferences key used to retrieve the old values.

1 Like

Where does SimpleApplication cache it’s settings?

In the Java user preferences:

https://docs.oracle.com/javase/8/docs/technotes/guides/preferences/index.html

On Windows systems, preferences are stored in the Windows Registry. On Linux systems, they’re stored in the filesystem.

See also:
https://jmonkeyengine.github.io/wiki/jme3/intermediate/appsettings.html#saving-and-loading-settings