Hey! I wanted to make my own game with Java, and so I found this engine.
I tried to follow the Hello SimpleApplication sample app in the wiki, but when I tried to run it, I got this error message:
Error
Jul 08, 2021 9:38:29 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.4.0-stable
* Branch: HEAD
* Git Hash: cb5173b
* Build Date: 2021-05-30
Jul 08, 2021 9:38:29 PM com.jme3.app.LegacyApplication handleError
SEVERE: Failed to create display
java.util.NoSuchElementException
at java.base/java.util.StringTokenizer.nextToken(StringTokenizer.java:347)
at org.lwjgl.opengl.GLContext.getSupportedExtensions(GLContext.java:234)
at org.lwjgl.opengl.ContextCapabilities.initAllStubs(ContextCapabilities.java:5802)
at org.lwjgl.opengl.ContextCapabilities.<init>(ContextCapabilities.java:6240)
at org.lwjgl.opengl.GLContext.useContext(GLContext.java:374)
at org.lwjgl.opengl.ContextGL.makeCurrent(ContextGL.java:195)
at org.lwjgl.opengl.DrawableGL.makeCurrent(DrawableGL.java:110)
at org.lwjgl.opengl.Display.makeCurrent(Display.java:706)
at org.lwjgl.opengl.Display.makeCurrentAndSetSwapInterval(Display.java:1025)
at org.lwjgl.opengl.Display.create(Display.java:852)
at org.lwjgl.opengl.Display.create(Display.java:757)
at com.jme3.system.lwjgl.LwjglDisplay.createContext(LwjglDisplay.java:140)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:120)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:221)
at java.base/java.lang.Thread.run(Thread.java:853)
Jul 08, 2021 9:38:30 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.IllegalMonitorStateException
at java.base/java.lang.Object.notifyAll(Native Method)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:135)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:221)
at java.base/java.lang.Thread.run(Thread.java:853)
䕸捥灴楯渠楮⁴桲敡搠≪䵅㌠䵡楮∠java.lang.NullPointerException: Cannot invoke "com.jme3.renderer.Renderer.cleanup()" because "this.renderer" is null
at com.jme3.system.lwjgl.LwjglDisplay.destroyContext(LwjglDisplay.java:158)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.deinitInThread(LwjglAbstractDisplay.java:205)
at com.jme3.system.lwjgl.LwjglAbstractDisplay$1.uncaughtException(LwjglAbstractDisplay.java:110)
at java.base/java.lang.Thread.uncaughtException(Thread.java:1363)
Here is the source code:
Source
package me.sql.exonrpg;
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;
import com.sun.tools.javac.Main;
import java.awt.*;
public class ExonRPG extends SimpleApplication {
public static void main(String[] args) {
ExonRPG game = new ExonRPG();
AppSettings settings = new AppSettings(true);
settings.setTitle("My Awesome Game");
game.setSettings(settings);
game.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
}
}
Here is some info about my PC/Java:
i5-4460
GTX 960
AdoptOpenJDK 16.0.1.9 with OpenJ9
8 GB Ram
JME 3.4.0
I am running on maven with IntelIiJ Idea.
Any help would be very appreciated!
Just a guess, but I would bet it is trying to run off your CPUs integrated graphics (Intel HD Graphics 4600), which intel is notorious for having drivers that report nonsensical things back for opengl information.
Something easy you could try is to update both your intel graphics driver, and your NVIDAI driver.
EDIT: Something I noticed is that you have java.awt imports present. (Along with com.sun.tools.javac.Main) Try cleaning up your imports. LWJGL3 has some incompatibilities with AWT.
I think he is using LWJGL 2 (from the stack). That being said, you can also try LWJGL 3 if it makes any difference. But then like said, only some headless functionality (like awt.graphics) can be used without any problems.