As I read that the latest JMonkey SDK supports desktop (Windows / Linux / Raspberry) deployment out of the box I had high hopes that the deployment could work out of the box…just one time…and I was disappointed and got annoyed again…as in simply every Java project I tried to deploy.
If I choose “BasicGame (Ant)” the deployment creates a executeable .jar package. The package runs on windows. But if I run it on my Raspberry 4 the game crashes with an lwjgl error. As I figured out it seems to depend on the lwjgl version. I have to change to lwjgl3…but if I read correctly, in Ant I would have to replace all dependies by hand.
Therefore I tried to choose “BasicGame (gradle)”. In the gradle script lwjgl3 seems to be the standard. So I not have to replace it. But the gradle distZip task does not generate a executeable .jar. It generates a .zip package of .jars with a batchfile, not suitable for Linux. So this setup is not useable for Raspberry 4, too.
If I try to reconfigure the gradle scripts to generate a executeable .jar (as I does in all my other Java projects I deploy) the script complains about the java version is not allowed to set twice and that the assets folder is not present to bundle.
So what the heck is the simpliest way to get a executeable .jar out of the SDK to run on Windows and Raspberry 4? So that after one week of script-fiddeling I finally can start developing a game?
https://start.jmonkeyengine.org/ is the best way to get a starter project. Projects started with it produce distributions for windows, mac and linux. I haven’t personally tested it with raspberry pi so I’ll be interesting to hear how it goes
It seems that you are having problems with your platform-dependent dependencies which reside in the lwjgl-3 modules. Make sure to add Linux armhf or arm64 lwjgl-3 binaries, for raspberry ANT builds you can use this project (it’s plain Java building, but the dependencies are the same, notice you will need to handle their updates manually using curl or other REST tools):
For Gradle builds try the Jme Initializer or use this project:
This page generates nearly the same as the “create BasicGame (Gradle)” option in the sdk. So the deploy result is the same. (.zip package) They only difference is, that the assets resides in the standard resources path which is more logical to me. (and maybe could be easier changed to a executeable .jar out of the box )
This is good to know! This unidentifiable file should be a shell script (.sh?)! If I ran the script file on the Raspberry 4 for a project set to lwjgl3 (regardless if from the page or the sdk) I got the same lwjgl error as for the Ant build. “failed to create context: GLXBadFBConfig” and “Failed to create the GLFW window”. So the lwjgl version seems not to be the problem!
Notice that this project is a community project and it’s totally open sourced, so feel free to describe your issue with it in details in order to fix them, and btw the fix is just a line in Gradle dependencies that will add the native pre-compiled binaries for lwjgl-3 for the arm64 and armhf.
Are you talking development environment or deploy environment?
The start based projects should produce 3 seperate zips for distribution. One for each os. I think there are instructions in the generated readme (im on holidsy so hard to check)
All my tested ways of project setups running fine on my windows sdk development environment. For deploy environment I selected Windows and Linux, Mac OS is not selected. All the tested setups generate a non-executeable .jar in the “/build/libs” path and just one .zip file in the “build/distributions” path (with .jars, the batch file, the shellscript file and no readme)
I now use the setup generated from the Initializer page as base and added the native dependencies like in the github example to the build.gradle dependencies section.
Ah, that won’t build the full distributions. You need to run the gradle task buildAllDistributions, building the full distributions every time would be slow so it isnt part of just a clean and build
(sorry for the vagueness, im away from my computer)
I tried the “buildAllDistributions” task. On reason It is such slow is because it bundles unnecessarily the jre, too. And if I run the script from the now created “GameName-linux” folder on the Raspberry I got “jre/bin/java” not found. So the jre link is not correct, too.
Aug. 17, 2024 9:29:43 AM com.jme3.system.JmeSystemDelegate lambda$new$1
WARNUNG: JmeDialogsFactory implementation not found.
Aug. 17, 2024 9:29:43 AM com.jme3.system.JmeDesktopSystem initialize
INFORMATION: Running on jMonkeyEngine 3.6.1-stable
* Branch: HEAD
* Git Hash: 4de10c3
* Build Date: 2023-06-23
Aug. 17, 2024 9:29:44 AM 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. 17, 2024 9:29:44 AM 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. 17, 2024 9:29:44 AM 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. 17, 2024 9:29:44 AM com.jme3.system.JmeSystemDelegate lambda$new$0
WARNUNG: JmeDialogsFactory implementation not found.
Failed to create display
RuntimeException: Failed to create the GLFW window
Aug. 17, 2024 9:29:44 AM com.jme3.system.lwjgl.LwjglWindow run
SCHWERWIEGEND: Display initialization failed. Cannot continue.
The Netbeans console says that the click on the “CleanAndBuild” button execcutes gradlew clean implicitly:
JAVA_HOME="C:\Program Files\jmonkeyplatform\jdk"
cd F:\Download\testordner\TestGame; .\gradlew.bat --configure-on-demand -x check clean build
Configuration on demand is an incubating feature.
> Task :cleanDLLs UP-TO-DATE
> Task :cleanDyLibs UP-TO-DATE
Thats the difficult one. What is non-compatible or necessary? I tried the dependencies in 32bit and 64bit and I tried to leave the sub-dependencies out at 32bit and 64bit, as mentioned in the other post…the same two exceptions all the time.
I don’t get it. I even checked the .jar package manually to see that the native files are present in the package. Interesting is, that regardless if I put 32, 64bit or none dependencies entries for the natives to the dependencies section, the distzip has all in:
Notice, if you are running WoR or a windows binary on raspberry, then it will never work with the examples on GitHub that I have mentioned above (and we as a community have never tested jMonkeyEngine on WoR platforms), so yeah you will have to get the windows lwjgl-3 binaries on arm, so I recommend to check lwjgl-3 in this case and let us know how to goes.
EDIT:
The examples I’ve mentioned above are only compatible with Linux-ARM32 platforms with hard floating, which you can get by installing the stock Raspbian OS or any comparative Arm-hf GNU/Linux OS.
The most accounted possibility now is that they are not added to the class path, I recommend you to try running using the Gradle runtime task directly to test before building a distribution.
EDIT:
You could also open the Jar file and check the MANIFEST file for the class-path attribute to see if it’s added.