Hi,
I’m beginning (and start learning) with jMonkeyEngine and trying to run the sample game (cf. jMonkeyEngine | Quick Start)
After experiencing a first issue here ((SOLVED) LWJGL3: ERROR: Context class is missing!)
I now have this issue:
GRAVE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.ExceptionInInitializerError
at org.lwjgl.glfw.GLFW.glfwInit(GLFW.java:1046)
at com.jme3.system.lwjgl.LwjglWindow.createContext(LwjglWindow.java:203)
at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:529)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:662)
at com.jme3.system.lwjgl.LwjglWindow.create(LwjglWindow.java:493)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:490)
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)
Caused by: java.lang.IllegalStateException: GLFW may only be used on the main thread and that thread must be the first thread in the process. Please run the JVM with -XstartOnFirstThread. This check may be disabled with Configuration.GLFW_CHECK_THREAD0.
at org.lwjgl.glfw.EventLoop.<clinit>(EventLoop.java:30)
... 9 more
So, I tried to add the JVM argument -XstartOnFirstThread, but when I do this, the application does not start.
(I’m on MacOS 12.0.1)
This is my maven dependencies configuration:
<dependencies>
<dependency>
<groupId>org.jmonkeyengine</groupId>
<artifactId>jme3-core</artifactId>
<version>3.5.2-stable</version>
</dependency>
<dependency>
<groupId>org.jmonkeyengine</groupId>
<artifactId>jme3-desktop</artifactId>
<version>3.5.2-stable</version>
</dependency>
<dependency>
<groupId>org.jmonkeyengine</groupId>
<artifactId>jme3-lwjgl3</artifactId>
<version>3.5.2-stable</version>
</dependency>
</dependencies>
And the code i’m trying to run:
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.system.AppSettings;
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
}
}
Also tried something else, by adding “app.initialize();” before “app.start();”. But got this:
juin 25, 2022 6:18:08 PM com.jme3.asset.AssetConfig loadText
AVERTISSEMENT: Cannot find loader com.jme3.scene.plugins.ogre.MeshLoader
juin 25, 2022 6:18:08 PM com.jme3.asset.AssetConfig loadText
AVERTISSEMENT: Cannot find loader com.jme3.scene.plugins.ogre.SkeletonLoader
juin 25, 2022 6:18:08 PM com.jme3.asset.AssetConfig loadText
AVERTISSEMENT: Cannot find loader com.jme3.scene.plugins.ogre.MaterialLoader
juin 25, 2022 6:18:08 PM com.jme3.asset.AssetConfig loadText
AVERTISSEMENT: Cannot find loader com.jme3.scene.plugins.ogre.SceneLoader
juin 25, 2022 6:18:08 PM com.jme3.asset.AssetConfig loadText
AVERTISSEMENT: Cannot find loader com.jme3.scene.plugins.fbx.FbxLoader
juin 25, 2022 6:18:08 PM com.jme3.asset.AssetConfig loadText
AVERTISSEMENT: Cannot find loader com.jme3.scene.plugins.gltf.GltfLoader
juin 25, 2022 6:18:08 PM com.jme3.asset.AssetConfig loadText
AVERTISSEMENT: Cannot find loader com.jme3.scene.plugins.gltf.BinLoader
juin 25, 2022 6:18:08 PM com.jme3.asset.AssetConfig loadText
AVERTISSEMENT: Cannot find loader com.jme3.scene.plugins.gltf.GlbLoader
juin 25, 2022 6:18:08 PM com.jme3.asset.AssetConfig loadText
AVERTISSEMENT: Cannot find loader com.jme3.audio.plugins.OGGLoader
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.jme3.system.JmeContext.getSettings()" because "this.context" is null
at com.jme3.app.LegacyApplication.initDisplay(LegacyApplication.java:278)
at com.jme3.app.LegacyApplication.initialize(LegacyApplication.java:637)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:198)
at com.elua.Main.main(Main.java:20)
Is there an issue with MacOS or anything else ?
Thanks for your help