SEVERE JmeDesktopSystem 10:35:35 AM CRITICAL ERROR: Context class is missing!
Make sure jme3_lwjgl-ogl is on the classpath.
java.lang.ClassNotFoundException: com.jme3.system.lwjgl.LwjglCanvas
In the discussion, Scrappers-glitch says:
“Just use lwjgl3 native window GLFW, or lwjgl-2 if you are using swing/AWT and want to utilize jme3 app within a swing application.”
I don’t know what to do, how I can use GLFW. I’m looking for help in the officiel (or unofficial) documentation but I can’t found anything.
Just replace the library jme3-lwjgl with jme3-lwjgl3 in your project to use LWJGL 3 instead of 2. How to do this depends entirely how your project is build. With ANT, Gradle or Maven?
LWJGL 2 works with Swing and canvas. 3 not so much, but it leverages GLFW if that is your cup of tea.
Then doing mvn install, run, and still get this issue
I’m running the sample code found in Quick Start:
public class Main extends SimpleApplication {
public static void main(String[] args) {
Main app = new Main();
AppSettings settings = new AppSettings(true);
settings.setTitle("My Awesome Game");
app.setSettings(settings);
app.start();
}
@Override
public void simpleInitApp() {
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
}
}
Looks like you are using LWJGL 3. So the java.lang.ClassNotFoundException: com.jme3.system.lwjgl.LwjglCanvas you will still get.
But this code example you gave… Are you sure you are getting the exact error you gave in the first post from this code? I don’t see how that would happen…
I’m sorry, you’re right, it’s not exactly the same. This is the complete error I have:
INFOS: Running on jMonkeyEngine 3.5.2-stable
* Branch: HEAD
* Git Hash: 8ab3d24
* Build Date: 2022-04-21
juin 20, 2022 2:27:12 PM com.jme3.system.JmeDesktopSystem newContextLwjgl
GRAVE: CRITICAL ERROR: Context class is missing!
Make sure jme3_lwjgl-ogl is on the classpath.
java.lang.ClassNotFoundException: com.jme3.system.lwjgl.LwjglDisplay
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 com.elua.Main.main(Main.java:20)
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.jme3.system.JmeContext.setSettings(com.jme3.system.AppSettings)" because "ctx" is null
at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:276)
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 com.elua.Main.main(Main.java:20)
May be deleting the maven cache and resyncing will solve your problem, as the lwjgl-3 dependencies are already there…so may be problem with network during the downloading or something.
OP wants to use LWJGL 3, jme3-lwjgl3 is correct then. jme3-lwjgl points to LWJGL 2.
And opinion-wise, maybe better at this point to start with LWJGL 3. It is the future, whether you want it or not. LWJGL 2 is very old and not developed anymore.