[SOLVED] Getting "SEVERE: Failed to find a JmeSystem delegate!" error

I am going through the JMonkeyEngine Hello World tutorial (jMonkeyEngine 3 Tutorial (1) - Hello SimpleApplication :: jMonkeyEngine Docs) and here is my first hurdle.

Whenever I run this code I get the following error:

Apr 17, 2022 6:42:37 AM com.jme3.system.JmeSystem checkDelegate
SEVERE: Failed to find a JmeSystem delegate!
Ensure either desktop or android jME3 jar is in the classpath.
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.jme3.system.JmeSystemDelegate.showSettingsDialog(com.jme3.system.AppSettings, boolean)" because "com.jme3.system.JmeSystem.systemDelegate" is null
        at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:155)
        at com.jme3.app.SimpleApplication.start(SimpleApplication.java:120)
        at Main.main(Main.java:8)

I run the code from the terminal (I like to work from the terminal). And, yeah, the jar file is in the classpath.

I don’t have any idea what’s wrong with the code. Maybe the compiler is ignoring the classpath or something like that, I don’t know. I just followed the tutorial. If you have any solution then please help me to troubleshoot.

UPDATE:
I was using the wrong library of JME. I was using the jme3-core library but the project requires the jme3-desktop (Note: jme3-desktop depends on jme3-core). That problem had been fixed but a new following problem had arisen.

Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:375)
        at com.jme3.system.JmeDesktopSystem.newContextLwjgl(JmeDesktopSystem.java:202)
        at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:275)
        at com.jme3.system.JmeSystem.newContext(JmeSystem.java:174)
        at com.jme3.app.LegacyApplication.start(LegacyApplication.java:488)
        at com.jme3.app.LegacyApplication.start(LegacyApplication.java:442)
        at com.jme3.app.SimpleApplication.start(SimpleApplication.java:126)
        at Main.main(Main.java:8)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:375)
        at com.jme3.system.JmeDesktopSystem.newContextLwjgl(JmeDesktopSystem.java:202)
        at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:275)
        at com.jme3.system.JmeSystem.newContext(JmeSystem.java:174)
        at com.jme3.app.LegacyApplication.start(LegacyApplication.java:488)
        at com.jme3.app.LegacyApplication.start(LegacyApplication.java:442)
        at com.jme3.app.SimpleApplication.start(SimpleApplication.java:126)
        at Main.main(Main.java:8)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:419)
        at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:192)
        at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:132)

The main issue had been fixed so I am marking the this post as “SOLVED”.

How did you build the application? Are you using the SDK? Something else?

What version of JME are you using?

It is neither an application nor trying to build one.
No, I ain’t using any SDK (Is there an SDK?). I run the code from the linux terminal.
Yes, I am using jme3-core-3.5.1-stable.jar JME library. I found it on the maven central repository.
I am using the v3.5.1 of the above mentioned library.

Purpose of using JME: I have a 3D car model which I want to play with. JAVA is my only programming language. So, JME is my only option.

You can use the jMonkeyEngine official SDK or gradle.

For SDK check :

For gradle check :

and by the way there is a quick start guide for jMonkeyEngine on jmonkeyengine org :

If you are insisting to use terminal only with custom build script, i have an example on my github (but remember you have to solve your problems yourself, there are no any official support for this and i don’t recommend it for general use) :

This happened due to a missing dependency at the classpath, you haven’t added jme3-desktop nor jme3-android on the classpath (in this case its jme3-desktop), that’s why its better to use the SDK or gradle.

I mean, you start with a .java file that has a main() method… and must get it to a .class file somehow, eh?

Hey bro, that had been fixed but now it cannot find the LWJGLException class file. Do you have any idea what is triggering the error. I have updated the post also.

You have to deal with the other LWJGL dependencies by the same scenario…use the examples above.

Yes, the necessary LWJGL jars are not on the classpath. JME is a moderately large engine with enough dependencies (jars) that managing them manually as you’re doing is going to be quite difficult. I’d strongly suggest looking into the Gradle template linked above - Gradle will manage all of your dependencies/classpath issues along with a host of other things that are either nice to have or critical (incremental compilation, managing compile/test/run classpath/dependencies, building distributable application installers, etc.).

2 Likes

And its worth noting that if youre using gradle you can still use the terminal, you’re just issuing gradle commands rather than javac commands.

2 Likes