For “running using the Gradle runtime task” I’m not sure what to do. Gradle has no task named “runtime”. Gradle has a task named “run”. If I “run” the game at Windows within the IDE with the gradle “run” task the game (the blue cube) shows up properly. Even if the the console complains about something:
JAVA_HOME="C:\Program Files\jmonkeyplatform\jdk"
cd F:\Download\testordner\TestGame; .\gradlew.bat --configure-on-demand -w -x check run
Configuration on demand is an incubating feature.
Aug. 18, 2024 4:27:52 PM com.jme3.system.JmeSystemDelegate lambda$new$1
WARNUNG: JmeDialogsFactory implementation not found.
Aug. 18, 2024 4:27:52 PM com.jme3.system.JmeDesktopSystem initialize
INFORMATION: Running on jMonkeyEngine 3.6.1-stable
* Branch: HEAD
* Git Hash: 4de10c3
* Build Date: 2023-06-23
Aug. 18, 2024 4:27:52 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFORMATION: LWJGL 3.3.2+13 context running on thread jME3 Main
* Graphics Adapter: GLFW 3.4.0 Win32 WGL Null EGL OSMesa VisualC DLL
Aug. 18, 2024 4:27:52 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFORMATION: OpenGL Renderer Information
* Vendor: NVIDIA Corporation
* Renderer: NVIDIA GeForce RTX 4070 Ti SUPER/PCIe/SSE2
* OpenGL Version: 3.2.0 NVIDIA 551.52
* GLSL Version: 1.50 NVIDIA via Cg compiler
* Profile: Core
Aug. 18, 2024 4:27:52 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMATION: Audio Renderer Information
* Device: OpenAL Soft
* Vendor: OpenAL Community
* Renderer: OpenAL Soft
* Version: 1.1 ALSOFT 1.23.0
* 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_loopback_bformat ALC_SOFT_output_limiter ALC_SOFT_output_mode ALC_SOFT_pause_device ALC_SOFT_reopen_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_bformat_ex AL_SOFTX_bformat_hoa AL_SOFT_block_alignment AL_SOFT_callback_buffer AL_SOFTX_convolution_reverb AL_SOFT_deferred_updates AL_SOFT_direct_channels AL_SOFT_direct_channels_remix AL_SOFT_effect_target AL_SOFT_events AL_SOFT_gain_clamp_ex AL_SOFTX_hold_on_disconnect 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 AL_SOFTX_source_start_delay AL_SOFT_UHJ
Aug. 18, 2024 4:27:52 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMATION: Audio effect extension version: 1.0
Aug. 18, 2024 4:27:52 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMATION: Audio max auxiliary sends: 2
Are you sure? I cannot see any class-path attribute here.
I am essentially talking about running this task on the raspberry runtime, jMonkeyEngine native library loader extracts the correspondent native binaries in runtime according to the Java runtime environment which is imposed by the platform running the application.
EDIT:
Your manifest file in the Java Archive (Jar) executable that you are trying to run on your Pi, should be similar to this one with the exception of the main-class attribute that is the class that has the main function which is the application entry point that get linked with your libjvm.so after the initial JVM boot:
Your crash logs here imply that the jMonkeyEngine core (jme3-core - jme3-lwjgl3 - jme3-desktop) is already added to the class-path, however, if the possibility that the linux-arm natives files are not added, then the cause of your crash can be attributed to the Class-Path part of your executable Jar which must have relative paths to look for Java classes dynamically.
Yes, it typically does. However, @Ir3nicuz develops the application on a windows amd64 machine then delivers a distribution Jar, that’s why I opened the class-path discussion. If they just use the Gradle wrapper then they might use the equivalent java -cp [] API and then yes it is automatically resolved, I suggested them so by the way. Anyway, I hope @Ir3nicuz would test the application using the Gradle run command first on the Pi.
At all my other in Java at Windows developed apps I instructed gradle in the IDE simply to bundle all dependencies to a executedable FatJar (even with native .so files). Therefore I have no experience in running/building directly on the Raspberry.
I installed gradle to the Raspberry and copied the whole project folder tree to the raspberry. If I run “gradle tasks” on the Project root folder (where the build.gradle resides) I got:
openjdk version "17.0.12" 2024-07-16
OpenJDK Runtime Environment (build 17.0.12+7-Debian-2deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.12+7-Debian-2deb12u1, mixed mode, sharing)
FAILURE: Build failed with an exception.
* Where:
Build file '/home/pi/TestGame/build.gradle' line: 89
* What went wrong:
Could not compile build file '/home/pi/TestGame/build.gradle'.
> startup failed:
build file '/home/pi/TestGame/build.gradle': 89: Ambiguous expression could be a parameterless closure expression, an isolated open code block, or it may continue a previous statement;
solution: Add an explicit parameter list, e.g. {it -> ...}, or force it to be treated as an open block by giving it a label, e.g. L:{...}, and also either remove the previous newline, or add an explicit semicolon ';' @ line 89, column 1.
{
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
For the “Class-Path” question:
Ah, you mean the “long list” of dependencies and not the class-path to the main method. I don’t missed this because my other projects don’t need it. This attribute is in no manifest file present. In the script file the distZip contains this is present:
Okay, what happens when you run ./gradlew run task.
You are having some syntactical issues at this DSL file, reference this line: 89 and fix this closure.
Yes, chances are, if you are running a standalone Jar file then you must have a Class-Path attribute referencing all the Jar dependencies in a MANIFEST file inside the application Jar (That is what the Java platform impose and not Gradle). But, if you are running from the Gradle task run then Gradle takes care of the runtime.
Running “./gradlew run” delivers this terminal output:
openjdk version "17.0.12" 2024-07-16
OpenJDK Runtime Environment (build 17.0.12+7-Debian-2deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.12+7-Debian-2deb12u1, mixed mode, sharing)
FAILURE: Build failed with an exception.
* Where:
Build file '/home/pi/TestGame/build.gradle' line: 89
* What went wrong:
Could not compile build file '/home/pi/TestGame/build.gradle'.
> startup failed:
build file '/home/pi/TestGame/build.gradle': 89: Ambiguous expression could be a parameterless closure expression, an isolated open code block, or it may continue a previous statement;
solution: Add an explicit parameter list, e.g. {it -> ...}, or force it to be treated as an open block by giving it a label, e.g. L:{...}, and also either remove the previous newline, or add an explicit semicolon ';' @ line 89, column 1.
{
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :run
Aug. 20, 2024 8:16:53 PM com.jme3.system.JmeSystemDelegate lambda$new$1
WARNUNG: JmeDialogsFactory implementation not found.
Aug. 20, 2024 8:16:53 PM com.jme3.system.JmeDesktopSystem initialize
INFORMATION: Running on jMonkeyEngine 3.6.1-stable
* Branch: HEAD
* Git Hash: 4de10c3
* Build Date: 2023-06-23
Aug. 20, 2024 8:16:54 PM com.jme3.app.LegacyApplication handleError
SCHWERWIEGEND: GLX: Failed to create context: GLXBadFBConfig
java.lang.Exception: GLX: Failed to create context: GLXBadFBConfig
at com.jme3.system.lwjgl.LwjglWindow$1.invoke(LwjglWindow.java:235)
at org.lwjgl.glfw.GLFWErrorCallbackI.callback(GLFWErrorCallbackI.java:43)
at org.lwjgl.system.JNI.invokePPPP(Native Method)
at org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058)
at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
at com.jme3.system.lwjgl.LwjglWindow.createContext(LwjglWindow.java:300)
at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:588)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:710)
at java.base/java.lang.Thread.run(Thread.java:840)
Aug. 20, 2024 8:16:54 PM com.jme3.system.JmeSystemDelegate lambda$new$0
WARNUNG: JmeDialogsFactory implementation not found.
GLX: Failed to create context: GLXBadFBConfig
Exception: GLX: Failed to create context: GLXBadFBConfig
Aug. 20, 2024 8:16:54 PM com.jme3.app.LegacyApplication handleError
SCHWERWIEGEND: Failed to create display
java.lang.RuntimeException: Failed to create the GLFW window
at com.jme3.system.lwjgl.LwjglWindow.createContext(LwjglWindow.java:302)
at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:588)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:710)
at java.base/java.lang.Thread.run(Thread.java:840)
Aug. 20, 2024 8:16:54 PM com.jme3.system.JmeSystemDelegate lambda$new$0
WARNUNG: JmeDialogsFactory implementation not found.
Failed to create display
RuntimeException: Failed to create the GLFW window
Aug. 20, 2024 8:16:54 PM com.jme3.system.lwjgl.LwjglWindow run
SCHWERWIEGEND: Display initialization failed. Cannot continue.
BUILD SUCCESSFUL in 5s
3 actionable tasks: 1 executed, 2 up-to-date
first brings up the “syntactical issues”, but tries to run the game despite it and then delivering the same two exceptions as before.
The noticeable point is, that the build.gradle is the original one created by the project initialization page and the SDK does not complain about its syntax as usual.
Comparing the blocks in the generated build.gradle file shows a difference for are really petty gradle speciality unasual for all other languages. Changing the block opener position from:
task buildWindowsDistribution(dependsOn: [distZip, downloadAndUnzipWindowsJre], type: Copy)
{
group 'distribution'
from files("${projectDir}/scripts/desktopDeployment/TestGame.bat"), zipTree(distZip.archiveFile), "${buildDir}/jres/windowsJre"
into new File(buildDir, 'distributions/TestGame-windows')
includeEmptyDirs false
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}
to:
task buildWindowsDistribution(dependsOn: [distZip, downloadAndUnzipWindowsJre], type: Copy) {
group 'distribution'
from files("${projectDir}/scripts/desktopDeployment/TestGame.bat"), zipTree(distZip.archiveFile), "${buildDir}/jres/windowsJre"
into new File(buildDir, 'distributions/TestGame-windows')
includeEmptyDirs false
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}
solves the syntactical error. Never the less it no solves the exceptions for lwjgl. After changing this block opener and running “./gradlew run” on the raspberry the terminal output shows the same error:
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :run
Aug. 21, 2024 7:38:50 PM com.jme3.system.JmeSystemDelegate lambda$new$1
WARNUNG: JmeDialogsFactory implementation not found.
Aug. 21, 2024 7:38:50 PM com.jme3.system.JmeDesktopSystem initialize
INFORMATION: Running on jMonkeyEngine 3.6.1-stable
* Branch: HEAD
* Git Hash: 4de10c3
* Build Date: 2023-06-23
Aug. 21, 2024 7:38:51 PM com.jme3.app.LegacyApplication handleError
SCHWERWIEGEND: GLX: Failed to create context: GLXBadFBConfig
java.lang.Exception: GLX: Failed to create context: GLXBadFBConfig
at com.jme3.system.lwjgl.LwjglWindow$1.invoke(LwjglWindow.java:235)
at org.lwjgl.glfw.GLFWErrorCallbackI.callback(GLFWErrorCallbackI.java:43)
at org.lwjgl.system.JNI.invokePPPP(Native Method)
at org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058)
at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
at com.jme3.system.lwjgl.LwjglWindow.createContext(LwjglWindow.java:300)
at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:588)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:710)
at java.base/java.lang.Thread.run(Thread.java:840)
Aug. 21, 2024 7:38:51 PM com.jme3.system.JmeSystemDelegate lambda$new$0
WARNUNG: JmeDialogsFactory implementation not found.
GLX: Failed to create context: GLXBadFBConfig
Exception: GLX: Failed to create context: GLXBadFBConfig
Aug. 21, 2024 7:38:51 PM com.jme3.app.LegacyApplication handleError
SCHWERWIEGEND: Failed to create display
java.lang.RuntimeException: Failed to create the GLFW window
at com.jme3.system.lwjgl.LwjglWindow.createContext(LwjglWindow.java:302)
at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:588)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:710)
at java.base/java.lang.Thread.run(Thread.java:840)
Aug. 21, 2024 7:38:51 PM com.jme3.system.JmeSystemDelegate lambda$new$0
WARNUNG: JmeDialogsFactory implementation not found.
Failed to create display
RuntimeException: Failed to create the GLFW window
Aug. 21, 2024 7:38:51 PM com.jme3.system.lwjgl.LwjglWindow run
SCHWERWIEGEND: Display initialization failed. Cannot continue.
BUILD SUCCESSFUL in 5s
3 actionable tasks: 1 executed, 2 up-to-date
I copied the whole project to my Raspberry and executed “./gradlew run” in the root folder of the project. The result in the terminal out is:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/pi/JmeCarPhysicsTestRPI/build.gradle' line: 8
* What went wrong:
A problem occurred evaluating root project 'JmeCarPhysicsTestRPI'.
> Could not set unknown property 'mainClassName' for root project 'JmeCarPhysicsTestRPI' of type org.gradle.api.Project.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
After that I loaded the project in the jMonkey SDK and got:
So simply building the project in the SDK does not work, too. My target Java version shall be 17, so I would prefer set the “JmeCarPhysicsTestRPI” project to a higher Gradle version. But maybe this cause the problem? I am simply lost in the version jungle…what (should) work together and what is needed? (Gradle, Java, LWJGL, OpenGL, OpenAI, …)
Nothing seems to work out of the box as base reference for further adaptions.
On clicking CleanAndBuild within the SDK after this change I got:
FAILURE: Build failed with an exception.
* Where:
Script 'F:\Download\testordner\TestGame2\build.gradle' line: 19
* What went wrong:
A problem occurred evaluating root project 'JmeCarPhysicsTestRPI'.
> Could not find method application() for arguments [build_4r3fdhg5t0tr8dixtp51gna8p$_run_closure2@84ee2d] on root project 'JmeCarPhysicsTestRPI' of type org.gradle.api.Project.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 175ms
Or does this only work with “./gradlew run” on the raspberry?
Now the CleanAndBuild in the SDK runs without errors and is running on windows.
But on the Raspberry this setup delivers with “./gradlew run” the error console output:
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava
> Task :processResources
> Task :classes
> Task :run
Aug. 26, 2024 7:25:07 PM com.jme3.system.JmeDesktopSystem initialize
INFORMATION: Running on jMonkeyEngine 3.3.2-stable
* Branch: HEAD
* Git Hash: 1a05e3f
* Build Date: 2020-04-27
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/pi/TestGame2/libbulletjme.so: /home/punishcube/PunishCubeGames/TestGame2/libbulletjme.so: falsche ELF-Klasse: ELFCLASS32 (Possible cause: can't load ARM .so on a AARCH64 platform)
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2394)
at java.base/java.lang.Runtime.load0(Runtime.java:755)
at java.base/java.lang.System.load(System.java:1957)
at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:685)
at com.jme3.system.JmeDesktopSystem.initialize(JmeDesktopSystem.java:348)
at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:271)
at com.jme3.system.JmeSystem.newContext(JmeSystem.java:159)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:461)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:424)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:127)
at TestRigidPhysics.main(TestRigidPhysics.java:21)
> Task :run FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-17-openjdk-arm64/bin/java'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 54s
3 actionable tasks: 3 executed
I’m happy that you took over it and progressed to the runtime. Good job! Just a remark, you needn’t the Pi4j GPIO and Extension dependencies; as Pi4j is a different framework from jMonkeyEngine (unless you are testing one of my examples which utilizes Pi4j for the Joystick controller API).
As for the error you get now, it’s related to the bullet physics library you are using, first of all before getting further on this topic, I need you to run a Test cube example to make sure everything is fine regarding the Lwjgl-3 APIs.
Lastly, the problem you are having in this stack here is a result of trying to dynamically link incompatible 32-bit executable linkable format (elf) library on an aarch-64 platform (arm-architecture 64), and to fix this we need to examine the bullet physics library you are using. Let’s just keep ourselves in a stepwise fashion to fix your problems. First, I need you to assert the Lwjgl-3 Window manager is running without any visual rendering problems through running a TestCube example.
You mean the window with the jMonkey logo to set several rendering options?
Check, this window is running fine on the raspberry.
All the upto now tested example projects (your project and the by Init-page or SDK generated “blue cube”) crashing at clicking “continue” on this window, when the game itself should show up.
That’s the settings window. No OpenGL has even been executed at that point.
He wanted you to run the blue cube example… which launches a window with a blue cube in it… to see if you see the blue cube.
Apparently, you don’t… so you still have issues that are unrelated to the most previously posted error about bullet native libraries. So now you can deal with the real problems before moving on to the advanced ones.