/** Sample 1 - how to get started with the most simple JME 3 application.
Display a blue 3D cube and view from all sides by
moving the mouse and pressing the WASD keys. */
public class HelloJME3 extends SimpleApplication {
@Override
public void simpleInitApp() {
Box b = new Box(1, 1, 1); // create cube shape
Geometry geom = new Geometry(“Box”, b); // create cube geometry from the shape
Material mat = new Material(assetManager,
“Common/MatDefs/Misc/Unshaded.j3md”); // create a simple material
mat.setColor(“Color”, ColorRGBA.Blue); // set color of material to blue
geom.setMaterial(mat); // set the cube’s material
rootNode.attachChild(geom); // make the cube appear in the scene
}
}
When i run this application in Windows enviroment (Windows 10 / JDK21), it works fine.
However when i run this application in Linux (RHEL 8.10 and JDK21)
it shows following error
run:
Feb 24, 2025 9:49:42 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.0-stable
Branch: HEAD
Git Hash: 53f2a49
Build Date: 2023-03-20
Feb 24, 2025 9:49:43 PM com.jme3.app.LegacyApplication handleError
SEVERE: Failed to initialize OpenGL context
org.lwjgl.LWJGLException: Could not find GLX 1.3 config from peer info
at org.lwjgl.opengl.LinuxPbufferPeerInfo.nInitHandle(Native Method)
at org.lwjgl.opengl.LinuxPbufferPeerInfo.(LinuxPbufferPeerInfo.java:52)
at org.lwjgl.opengl.LinuxDisplay.createPbuffer(LinuxDisplay.java:1348)
at org.lwjgl.opengl.Pbuffer.createPbuffer(Pbuffer.java:235)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:220)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:191)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:167)
at com.jme3.system.lwjgl.LwjglCanvas.makePbufferAvailable(LwjglCanvas.java:350)
at com.jme3.system.lwjgl.LwjglCanvas.createContext(LwjglCanvas.java:490)
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:1583)
Feb 24, 2025 9:49:45 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
Graphics Adapter: null
Driver Version: null
Scaling Factor: 1
Feb 24, 2025 9:49:46 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
AL extensions: AL_EXT_ALAW 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_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
Feb 24, 2025 9:49:46 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
Feb 24, 2025 9:49:46 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Feb 24, 2025 9:49:46 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 4
Feb 24, 2025 9:49:47 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[#20,jME3 Main,6,main]
java.lang.NullPointerException: Cannot invoke “com.jme3.renderer.Renderer.getStatistics()” because the return value of “com.jme3.app.Application.getRenderer()” is null
at com.jme3.app.StatsAppState.loadStatsView(StatsAppState.java:190)
at com.jme3.app.StatsAppState.initialize(StatsAppState.java:162)
at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:332)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:362)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:258)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:160)
at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:231)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:242)
at java.base/java.lang.Thread.run(Thread.java:1583)
Exception: java.lang.NullPointerException thrown from the UncaughtExceptionHandler in thread “jME3 Main”
You are running on LWJGL 2 it seems, which is the default. You can try with LWJGL 3. But there is a catch, LWJGL 3 works with Swing only on jME 3.7 and onwards. With 3.6 you’ll have no luck getting it to work.
run:
Feb 26, 2025 1:40:34 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.7.0-stable
Branch: HEAD
Git Hash: bc6cdf5
Build Date: 2024-10-21
Feb 26, 2025 1:40:34 AM com.jme3.app.LegacyApplication handleError
SEVERE: Failed to initialize OpenGL context
org.lwjgl.LWJGLException: Could not find GLX 1.3 config from peer info
at org.lwjgl.opengl.LinuxPbufferPeerInfo.nInitHandle(Native Method)
at org.lwjgl.opengl.LinuxPbufferPeerInfo.(LinuxPbufferPeerInfo.java:52)
at org.lwjgl.opengl.LinuxDisplay.createPbuffer(LinuxDisplay.java:1348)
at org.lwjgl.opengl.Pbuffer.createPbuffer(Pbuffer.java:235)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:220)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:191)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:167)
at com.jme3.system.lwjgl.LwjglCanvas.makePbufferAvailable(LwjglCanvas.java:350)
at com.jme3.system.lwjgl.LwjglCanvas.createContext(LwjglCanvas.java:490)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:120)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:224)
at java.base/java.lang.Thread.run(Thread.java:1583)
Feb 26, 2025 1:40:34 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.5 context running on thread jME3 Main
Graphics Adapter: null
Driver Version: null
Scaling Factor: 1
Feb 26, 2025 1:40:34 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
AL extensions: AL_EXT_ALAW 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_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
Feb 26, 2025 1:40:34 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
Feb 26, 2025 1:40:34 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Feb 26, 2025 1:40:34 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 4
Feb 26, 2025 1:40:35 AM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[#20,jME3 Main,6,main]
java.lang.NullPointerException: Cannot invoke “com.jme3.renderer.Renderer.getStatistics()” because the return value of “com.jme3.app.Application.getRenderer()” is null
at com.jme3.app.StatsAppState.loadStatsView(StatsAppState.java:190)
at com.jme3.app.StatsAppState.initialize(StatsAppState.java:162)
at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:332)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:362)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:260)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:163)
at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:231)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:245)
at java.base/java.lang.Thread.run(Thread.java:1583)
Exception: java.lang.NullPointerException thrown from the UncaughtExceptionHandler in thread “jME3 Main”
Also i checked GLX details. It shows as below
[admin@localhost ~]$ glxinfo | grep -1 version
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
GLX_SGI_swap_control, GLX_SGI_video_sync
GLX version: 1.4
GLX extensions:
Preferred profile: core (0x1)
Max core profile version: 4.5
Max compat profile version: 4.5
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
OpenGL version string: 4.5 (Compatibility Profile) Mesa 23.1.4
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.1.4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
Phew, well, my questions and suggestions are still the same. I’m not going to offer them for the 3rd time. I assume you tried them despite seeing any evidence you did.
It’s a bit difficult to read the output you shared (I suggest you follow the standard shared by @pspeed), from what I see it can’t load or find GLX which is the GL library for X11, so you may need to check the window manager you are using (since lwjg2 has no Wayland support).
From my experience, you have to use lwjgl3 if running jme with swing on linux. This combination will not work with lwjgl2.
I had the same issue when I switched my PC from windows to linux. I ended up having to upgrade to lwjgl3 to get my application working on linux.
Also you have to use the latest stable version of jme (3.7). Older versions did not work with swing + lwjgl3