Failed to create display; NoSuchElement with Hello SimpleApplication

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! :smiley:

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.

How can I change lwjgl version?

I switched to lwjgl3 3.4.0-stable and now I get this error message:

Error
Jul 09, 2021 10:07:13 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.4.0-stable
 * Branch: HEAD
 * Git Hash: cb5173b
 * Build Date: 2021-05-30
Jul 09, 2021 10:07:14 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 3.2.3 build 13 context running on thread jME3 Main
 * Graphics Adapter: GLFW 3.4.0 Win32 WGL EGL OSMesa VisualC DLL
Jul 09, 2021 10:07:14 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: NVIDIA GeForce GTX 960/PCIe/SSE2
 * OpenGL Version: 4.6.0 NVIDIA 471.11
 * GLSL Version: 4.60 NVIDIA
 * Profile: Compatibility
Jul 09, 2021 10:07:14 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.MeshLoader
Jul 09, 2021 10:07:14 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.SkeletonLoader
Jul 09, 2021 10:07:14 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.MaterialLoader
Jul 09, 2021 10:07:14 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.SceneLoader
Jul 09, 2021 10:07:14 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.fbx.FbxLoader
Jul 09, 2021 10:07:14 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.gltf.GltfLoader
Jul 09, 2021 10:07:14 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.gltf.BinLoader
Jul 09, 2021 10:07:14 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.gltf.GlbLoader
Jul 09, 2021 10:07:14 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.audio.plugins.OGGLoader
Jul 09, 2021 10:07:14 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.19.1
 * Supported channels: 64
 * ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_device_clock ALC_SOFT_HRTF ALC_SOFT_loopback ALC_SOFT_output_limiter ALC_SOFT_pause_device
 * AL extensions: AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STEREO_ANGLES AL_LOKI_quadriphonic AL_SOFT_block_alignment AL_SOFT_deferred_updates AL_SOFT_direct_channels AL_SOFTX_events AL_SOFTX_filter_gain_ex AL_SOFT_gain_clamp_ex AL_SOFT_loop_points AL_SOFTX_map_buffer AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length AL_SOFT_source_resampler AL_SOFT_source_spatialize
Jul 09, 2021 10:07:14 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Jul 09, 2021 10:07:14 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 2
Jul 09, 2021 10:07:14 AM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.NullPointerException: Cannot read the array length because "this.pages" is null
	at com.jme3.font.BitmapFont.getPageSize(BitmapFont.java:120)
	at com.jme3.font.BitmapText.<init>(BitmapText.java:64)
	at com.jme3.font.BitmapText.<init>(BitmapText.java:60)
	at com.jme3.app.StatsAppState.setFont(StatsAppState.java:88)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:235)
	at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:520)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:619)
	at com.jme3.system.lwjgl.LwjglWindow.create(LwjglWindow.java:473)
	at com.jme3.app.LegacyApplication.start(LegacyApplication.java:491)
	at com.jme3.app.LegacyApplication.start(LegacyApplication.java:443)
	at com.jme3.app.SimpleApplication.start(SimpleApplication.java:126)
	at me.sql.exonrpg.ExonRPG.main(ExonRPG.java:17)


Process finished with exit code 1

Is this you entire source code?

Yes, I also have a pom.xml:

pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>me.sql</groupId>
    <artifactId>exonrpg</artifactId>
    <version>1.0</version>

    <properties>
        <maven.compiler.source>16</maven.compiler.source>
        <maven.compiler.target>16</maven.compiler.target>
        <jme3_g>org.jmonkeyengine</jme3_g>
        <jme3_v>3.4.0-stable</jme3_v>
    </properties>

    <repositories>
        <repository>
            <id>jcenter</id>
            <url>https://jcenter.bintray.com/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>${jme3_g}</groupId>
            <artifactId>jme3-core</artifactId>
            <version>${jme3_v}</version>
        </dependency>
        <dependency>
            <groupId>${jme3_g}</groupId>
            <artifactId>jme3-desktop</artifactId>
            <version>${jme3_v}</version>
        </dependency>
        <dependency>
            <groupId>${jme3_g}</groupId>
            <artifactId>jme3-lwjgl3</artifactId>
            <version>${jme3_v}</version>
        </dependency>
    </dependencies>

</project>

This appears to be a font issue. Are you running on an English version of Windows 10?