Unable to call JME application in Swing

I am using JME3.7.0-stable.zip

windows jdk 21, it works fine. no problem.

However in RHEL 8.10, JDK21

Failed to initialize OpenGL context
LWJGLException: Could not find GLX 1.3 config from peer info

How to resolve this problem…?

Check that you have latest and greatest display drivers. Also you might want to test LWJGL 2 or 3, depending which one you are using now.

Also what does Swing do here?

I tried on JME3.6.0-stable.zip

My Application has two java file

  1. HelloJME3.java - has SimpleApplication (JME)
  2. mySwing.java - Calls SimpleApplication through JPanel > canvas

HelloJME3

import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.math.ColorRGBA;

/** 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
    }
    }

mySwing

import com.jme3.system.AppSettings;
import com.jme3.system.JmeCanvasContext;
import java.awt.Canvas;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;

/*

  • Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
  • Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
    */

/**
*

  • @author ADMIN
    */
    public class mySwing {

    public static void main(String args){
    HelloJME3 app = new HelloJME3();
    //app.start(); // start the game

     java.awt.EventQueue.invokeLater(new Runnable() {
    

    public void run() {
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);

     app.setSettings(settings);
     app.setPauseOnLostFocus(false);
     app.createCanvas();
     app.startCanvas(true);
     
     JmeCanvasContext context = (JmeCanvasContext) app.getContext();
     Canvas canvas = context.getCanvas();
     canvas.setSize(settings.getWidth(), settings.getHeight());
    

    // In this case the JME Canvas is not centered in the JFrame
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.getContentPane().add(canvas);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    }
    });

    }
    }

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
  • Device: OpenAL Soft
  • Vendor: OpenAL Community
  • Renderer: OpenAL Soft
  • Version: 1.1 ALSOFT 1.15.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_loopback
  • 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”

Kindly let me how to resolve this.

As to your actual problem…

The older lwjgl2 works with Swing. The newer lwjgl3 does not like Swing.

I think at some version, JME changed which one it defaults to.

2 Likes

Are you running the latest graphics drivers?

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.

i checked on jME 3.7

Still not working… Pls check following output

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
  • Device: OpenAL Soft
  • Vendor: OpenAL Community
  • Renderer: OpenAL Soft
  • Version: 1.1 ALSOFT 1.15.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_loopback
  • 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

Memory info (GL_ATI_meminfo):

OpenGL renderer string: llvmpipe (LLVM 17.0.2, 128 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 23.1.4
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)

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:

GL_EXT_shader_framebuffer_fetch_non_coherent, GL_EXT_shader_group_vote, 
GL_EXT_shader_implicit_conversions, GL_EXT_shader_integer_mix, 
GL_EXT_shader_io_blocks, GL_EXT_tessellation_point_size, 

[admin@localhost ~]$

Kindly guide.

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.

Hi @mahesh_jme

First I would like to ask a couple of things.

  • Are you using Waylanda?
  • Do you have XWaylanda enabled?

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).

You can also try lwjgl3 as @tonihele mentioned.

1 Like

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

2 Likes

Kindly let me now, how to include lwjgl3 in the existing project. I am using Apache-netbeans-2-4 with Ant.

Just swap out LWJGL jar with LWJGL3 jar, that should be it.

1 Like

-rw-r–r-- 1 root root 265030 Apr 3 07:14 gson.jar
-rw-r–r-- 1 root root 536430 Apr 3 07:14 jbullet.jar
-rw-r–r-- 1 root root 207250 Apr 3 07:14 jinput.jar
-rw-r–r-- 1 root root 240835 Apr 3 07:14 jinput-natives-all.jar
-rw-r–r-- 1 root root 20827 Apr 3 07:14 jme3-android-native-sources.jar
-rw-r–r-- 1 root root 115697 Apr 3 07:14 jme3-android-sources.jar
-rw-r–r-- 1 root root 21566 Apr 3 07:14 jme3-awt-dialogs.jar
-rw-r–r-- 1 root root 11758 Apr 3 07:14 jme3-awt-dialogs-sources.jar
-rw-r–r-- 1 root root 2096695 Apr 3 07:14 jme3-core.jar
-rw-r–r-- 1 root root 3870391 Apr 3 07:14 jme3-core-sources.jar
-rw-r–r-- 1 root root 237114 Apr 3 07:14 jme3-desktop.jar
-rw-r–r-- 1 root root 200988 Apr 3 07:14 jme3-desktop-sources.jar
-rw-r–r-- 1 root root 580356 Apr 3 07:14 jme3-effects.jar
-rw-r–r-- 1 root root 589651 Apr 3 07:14 jme3-effects-sources.jar
-rw-r–r-- 1 root root 32556 Apr 3 07:14 jme3-ios-sources.jar
-rw-r–r-- 1 root root 233971 Apr 3 07:14 jme3-jbullet.jar
-rw-r–r-- 1 root root 469195 Apr 3 07:14 jme3-jbullet-sources.jar
-rw-r–r-- 1 root root 10530 Apr 3 07:14 jme3-jogg.jar
-rw-r–r-- 1 root root 8437 Apr 3 07:14 jme3-jogg-sources.jar
-rw-r–r-- 1 root root 101425 Apr 3 07:14 jme3-lwjgl3-sources.jar
-rw-r–r-- 1 root root 102521 Apr 3 07:14 jme3-lwjgl.jar
-rw-r–r-- 1 root root 69672 Apr 3 07:14 jme3-lwjgl-sources.jar
-rw-r–r-- 1 root root 193477 Apr 3 07:14 jme3-networking.jar
-rw-r–r-- 1 root root 223677 Apr 3 07:14 jme3-networking-sources.jar
-rw-r–r-- 1 root root 42123 Apr 3 07:14 jme3-niftygui.jar
-rw-r–r-- 1 root root 34139 Apr 3 07:14 jme3-niftygui-sources.jar
-rw-r–r-- 1 root root 338217 Apr 3 07:14 jme3-plugins.jar
-rw-r–r-- 1 root root 7783 Apr 3 07:14 jme3-plugins-json-gson.jar
-rw-r–r-- 1 root root 16373 Apr 3 07:14 jme3-plugins-json-gson-sources.jar
-rw-r–r-- 1 root root 4465 Apr 3 07:14 jme3-plugins-json.jar
-rw-r–r-- 1 root root 18919 Apr 3 07:14 jme3-plugins-json-sources.jar
-rw-r–r-- 1 root root 292945 Apr 3 07:14 jme3-plugins-sources.jar
-rw-r–r-- 1 root root 192519 Apr 3 07:14 jme3-terrain.jar
-rw-r–r-- 1 root root 204295 Apr 3 07:14 jme3-terrain-sources.jar
-rw-r–r-- 1 root root 187889602 Apr 3 07:14 jme3-testdata-sources.jar
-rw-r–r-- 1 root root 23871226 Apr 3 07:14 jme3-vr-sources.jar
-rw-r–r-- 1 root root 73123 Apr 3 07:14 j-ogg-vorbis.jar
-rw-r–r-- 1 root root 31866 Apr 3 07:14 jsr305.jar
-rw-r–r-- 1 root root 1076471 Apr 3 07:14 lwjgl.jar
-rw-r–r-- 1 root root 572075 Apr 3 07:14 lwjgl-platform-natives-linux.jar
-rw-r–r-- 1 root root 426809 Apr 3 07:14 lwjgl-platform-natives-osx.jar
-rw-r–r-- 1 root root 613736 Apr 3 07:14 lwjgl-platform-natives-windows.jar
-rw-r–r-- 1 root root 263472 Apr 3 07:14 nifty-default-controls.jar
-rw-r–r-- 1 root root 785564 Apr 3 07:14 nifty.jar
-rw-r–r-- 1 root root 169541 Apr 3 07:14 vecmath.jar
-rw-r–r-- 1 root root 120069 Apr 3 07:14 xpp3.jar

Above all *.jar of DOWNLOADED FROM

https://github.com/jMonkeyEngine/jmonkeyengine/releases/download/v3.7.0-stable/jME3.7.0-stable.zip

Kindly let me know which file has to be renamed to what, to get lwgl3 activated in the program.

Don’t rename anything. Just use alternate JARs. You can’t find these JARs from the ZIP distribution, seems that only LWJGL 2 is included in that.

You can however get the from i.e. Maven Central (https://mvnrepository.com/artifact/org.jmonkeyengine/jme3-lwjgl3/3.7.0-stable). But also you should really consider using Gradle or Maven. Managing dependencies with Ant requires some skill that modern humans don’t have anymore…

When i created fresh maven repository based JME 3-7 with lwgl3.

It shows following error

Error: Could not find or load main class com.jm3test.mavenproject1.Mavenproject1
Caused by: java.lang.ClassNotFoundException: com.jm3test.mavenproject1.Mavenproject1
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:1000)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:947)
at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:471)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke (Method.java:580)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)

BUILD FAILURE

Total time: 0.687 s
Finished at: 2025-04-03T07:57:23-04:00

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:exec (default-cli) on project mavenproject1: Command execution failed.: Process exited with an error: 1 (Exit value: 1) → [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] MojoExecutionException - Apache Maven - Apache Software Foundation

Refer Screenshot

1 Like

Well, even I don’t see it. So probably not Maven either. Probably best to try to Google or use your favourite AI to solve any Maven problems you should have.

I would at least limit my aid to be quite jME specific. Besides jME kinda assumes you know Java and build systems. If you struggle with the latter and don’t particularly want to get invested into those, you should either use jME SDK or the quick start on the web page to create a project structure for you so you can simply focus on the coding part.

Can you have graphics card in your linux system?

Hi @mahesh_jme

I’m not sure what you’re doing, but from the image you shared and the maven output, it looks like on line 1 you don’t have the package defined.

package com.example.mypackage;

Since i am posting my query very long period. I just rewind all the issue as follows

  1. I wanted to call JME SimpleApplication, through Swing canvas.
  2. In windows 10 the program it works absolutely fine.
  3. i used Apache Netbeans 22, JDK 22
  4. i used https://github.com/jMonkeyEngine/jmonkeyengine/releases/download/v3.7.0-stable/jME3.7.0-stable.zip
  5. However when i try to run the same application on Linux (RHEL 9.4 / Netbeans 22, JDK 22) it showed following error

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:353)
at com.jme3.system.lwjgl.LwjglCanvas.createContext(LwjglCanvas.java:492)
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:1570)

  1. However when i run this program on high-end workstation having dedicated NVIDIA card
    it runs smoothly.

  2. However on simple desktop computer having integrated graphics card, it shows above error. (Point No 5.)

  3. i was asked by JME experts on this discussion to use Maven repository instead of Simple inclusion of jars directly from JME -3-7-0-stable.zip

  4. Based on the advice i created a same program having maven repository base.

  5. This time following error shown

-----------------< com.mycompany:TRY_SWING_JME_MAVEN >------------------
Building TRY_SWING_JME_MAVEN 1.0-SNAPSHOT
from pom.xml
--------------------------------[ jar ]---------------------------------

— resources:3.3.1:resources (default-resources) @ TRY_SWING_JME_MAVEN —
skip non existing resourceDirectory /home/admin/NetBeansProjects/TRY_SWING_JME_MAVEN/src/main/resources

— compiler:3.11.0:compile (default-compile) @ TRY_SWING_JME_MAVEN —
Nothing to compile - all classes are up to date

— exec:3.1.0:exec (default-cli) @ TRY_SWING_JME_MAVEN —

LWJGL-OpenGL3
Apr 06, 2025 3:19:13 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.7.0-stable

  • Branch: HEAD
  • Git Hash: bc6cdf5
  • Build Date: 2024-10-21
    Apr 06, 2025 3:19:15 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
    INFO: LWJGL 3.3.3+5 context running on thread jME3 Main
  • Graphics Adapter: GLFW 3.4.0 Wayland X11 GLX Null EGL OSMesa monotonic shared
    Apr 06, 2025 3:19:15 PM com.jme3.system.lwjgl.LwjglCanvas printContextInitInfo
    INFO: Initializing LWJGL3-AWT with jMonkeyEngine
  • Double Buffer: true
  • Stereo: false
  • Red Size: 8
  • Rreen Size: 8
  • Blue Size: 8
  • Alpha Size: 0
  • Depth Size: 24
  • Stencil Size: 0
  • Accum Red Size: 0
  • Accum Green Size: 0
  • Accum Blue Size: 0
  • Accum Alpha Size: 0
  • Sample Buffers: 0
  • Share Context: null
  • Major Version: 3
  • Minor Version: 2
  • Forward Compatible: false
  • Profile: COMPATIBILITY
  • API: GL
  • Debug: false
  • Swap Interval: 1
  • SRGB (Gamma Correction): true
  • Pixel Format Float: false
  • Context Release Behavior: null
  • Color Samples NV: 0
  • Swap Group NV: 0
  • Swap Barrier NV: 0
  • Robustness: false
  • Lose Context On Reset: false
  • Context Reset Isolation: false

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00007f110b28d004, pid=10658, tid=10684

JRE version: Java™ SE Runtime Environment (22.0.2+9) (build 22.0.2+9-70)

Java VM: Java HotSpot™ 64-Bit Server VM (22.0.2+9-70, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)

Problematic frame:

C [libc.so.6+0x8d004] pthread_mutex_lock+0x4

Core dump will be written. Default location: Core dumps may be processed with “/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h” (or dumping to /home/admin/NetBeansProjects/TRY_SWING_JME_MAVEN/core.10658)

An error report file with more information is saved as:

/home/admin/NetBeansProjects/TRY_SWING_JME_MAVEN/hs_err_pid10658.log

If you would like to submit a bug report, please visit:

Crash Report

The crash happened outside the Java Virtual Machine in native code.

See problematic frame for where to report the bug.

  1. Refer hs_err_pid10658.log, screen shots

If any body guide, how to resolve this issue.

Regards

I usually create a GL context (JME3) with AWT as follows (works on Windows and Linux as long as LWJGL3 is used).

To start a GL context with LWJGL3, you can follow these steps:

  1. Create your JME3 main class
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;

public class Jme3Application extends SimpleApplication {

    private Geometry geom;

    @Override
    public void simpleInitApp() {
        getFlyByCamera().setEnabled(false);
        getFlyByCamera().unregisterInput();

        Box b = new Box(1, 1, 1);
        geom = new Geometry("Box", b);

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Orange);
        geom.setMaterial(mat);


        rootNode.attachChild(geom);
    }

    @Override
    public void simpleUpdate(float tpf) {
        float speed = FastMath.PI/2;
        geom.rotate(0, tpf * speed, 0);
    }
}
  1. Create the AWT class where the JME3 GL context will be attached
import com.jme3.system.JmeCanvasContext;

import javax.swing.*;
import java.awt.*;
import java.util.logging.Level;
import java.util.logging.Logger;

public class AWTApplication extends JFrame {

    private Jme3Application app3D;
    private Canvas canvas;
    private JPanel myContextPanel;

    public AWTApplication() {
        simpleInitApp();
    }

    private void simpleInitApp() {
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setTitle("AWT - LWJGL3");

        myContextPanel = new JPanel();
        myContextPanel.setLayout(new BorderLayout());

        getContentPane().add(myContextPanel);

        /* start JME3 */
        setupJMEContext();

        pack();
        setLocationRelativeTo(null);
    }

    private void setupJMEContext() {
        app3D = new Jme3Application();
        app3D.createCanvas();
        app3D.startCanvas();

        canvas = ((JmeCanvasContext) app3D.getContext()).getCanvas();
        if (canvas == null) {
            JOptionPane.showMessageDialog(null, "Error starting GL context");
            return;
        }

        canvas.setPreferredSize(new Dimension(1024, 576));
        myContextPanel.add(canvas, BorderLayout.CENTER);
    }

    public static void main(String[] args) {
        try {
            for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException |
                 IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            Logger.getLogger(AWTApplication.class.getName()).log(Level.SEVERE, null, ex);
        }

        /* start AWT/Swing and JME3 */
        EventQueue.invokeLater(() -> {
            new AWTApplication().setVisible(true);
        });
    }
}

I’m not a big fan of Maven (I like Gradle more than Maven), but for this test I have the following dependencies in Maven (pom.xml file).

<dependencies>
        <dependency>
            <groupId>org.jmonkeyengine</groupId>
            <artifactId>jme3-core</artifactId>
            <version>3.7.0-stable</version>
        </dependency>
        <dependency>
            <groupId>org.jmonkeyengine</groupId>
            <artifactId>jme3-plugins</artifactId>
            <version>3.7.0-stable</version>
        </dependency>

        <dependency>
            <groupId>org.jmonkeyengine</groupId>
            <artifactId>jme3-desktop</artifactId>
            <version>3.7.0-stable</version>
        </dependency>

        <dependency>
            <groupId>org.jmonkeyengine</groupId>
            <artifactId>jme3-lwjgl3</artifactId>  <!-- USE LWJGL3 -->
            <version>3.7.0-stable</version>
        </dependency>
    </dependencies>
  1. You will see a cube spinning on the screen.

[ EDIT ]
You can see some examples here

1 Like