I have created a scene and would now like to save it as an exe. Unfortunately it does not work…
that’s why i tried it with the standard example - same problem …
Am I doing something wrong?
I have java14 so I tried Java11 in the engine
Sorry I’m total beginner
you need to have java installed.
if you want it bundled with the application,
also select the last checkbox in the second screenshot (toghter with Windows 64-bit)
If you want run the .jar from command line check you have the right version of JAVA installed.
For all OS, to know your JAVA version (and if you have installed it) open a cmd and lunch this:
java -version
Ideally you have the same version set under Properties->Libraries->JavaPlatform.
To run the .jar copy/paste the command suggested from the builder, or open the cmd in the same folder where is placed your .jar and run:
java -jar nameFile.jar
If it doesn’t work read what is gone wrong, usually there is a self-explaining LOG, for example there are exceptions you have to fix before be able to run it.
Now my procedure to create a .exe and standalone software (example with Win64 and JDK11):
Compared to the request of the OP, I also want embedded the JDK in order to create a standalone software. In this way who run my game don’t need to install JAVA *(it have a cost, see below).
I suggest to proceed as follow:
Generate the .jar (clean and build of your working project)
Build Date: 2021-10-17
Exception in thread “main” java.lang.UnsatisfiedLinkError: The required native library ‘bulletjme’ was not found in the classpath via ‘native/windows/x86_64/bulletjme.dll’. Error message: no bulletjme in java.library.path: [C:\Program Files\Java\jdk-11\bin, C:\Windows\Sun\Java\bin, C:\Windows\system32, C:\Windows, C:\Program Files\Java\jdk-11\bin, C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin, C:\Users\alessa.foerster\Desktop\Python2.0\Eckdame, C:\Users\alessa.foerster\Desktop\Python2.0\chessmaster, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0, C:\Windows\SysWOW64\Empirum, C:\Program Files\MATLAB\R2020b\bin, C:\Program Files\dotnet, C:\Program Files (x86)\dotnet, C:\Program Files\nodejs, C:\Program Files\TortoiseGit\bin, C:\Program Files\apache-maven-3.8.1-bin\apache-maven-3.8.1\bin, C:\Program Files\Docker\Docker\resources\bin, C:\ProgramData\DockerDesktop\version-bin, C:\Users\alessa.foerster\AppData\Local\Programs\Python\Python38\Scripts, C:\Users\alessa.foerster\AppData\Local\Programs\Python\Python38, C:\Users\alessa.foerster\AppData\Local\Microsoft\WindowsApps, C:\Users\alessa.foerster\Desktop\Microsoft VS Code\bin, C:\Users\alessa.foerster\AppData\Roaming\npm, C:\Users\alessa.foerster\AppData\Local\GitHubDesktop\bin, C:\Users\alessa.foerster\AppData\Local\Programs\Git\cmd, .]
at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:598)
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 mygame.Main.main(Main.java:19)
and when I want to open the created exe-file this comes up:
this is in the engine when I want clear & build:
C:\Users\alessa.foerster\Desktop\Test44\nbproject\desktop-deployment-impl.xml:61: The following error occurred while executing this line:
C:\Users\alessa.foerster\Desktop\Test44\nbproject\desktop-deployment-impl.xml:65: src ‘C:\Users\alessa.foerster\Desktop\Test44\resources\desktop-deployment\jre-windows-x64.tar.gz’ doesn’t exist.
maybe you could try to download jre-8u202-windows-x64.tar.gz
rename it to jre-windows-x64.tar.gz and put it as
‘C:\Users\alessa.foerster\Desktop\Test44\resources\desktop-deployment\jre-windows-x64.tar.gz’
are you 100 % sure the path and the name is correct and its still the same error message?
also the exe you should start is in a .zip in the projectname/dist directory
I have now solved it for the time being by connecting JME3 with Eclipse. There I then created a Jar file and converted it with a converter into an exe…
it runs but unfortunately only objects that I have imported directly in the code are displayed. The scene with landscape is missing.
C:\Users\liesc\workspace\bubble\build\install\bubble\MyGame_WinX64>java.lang.NoClassDefFoundError: com/jme3/app/SimpleApplication
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:514)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:422)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:416)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:691)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:415)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
Caused by: java.lang.ClassNotFoundException: com.jme3.app.SimpleApplication
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:435)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
… 10 more
Error: failed to load/find main class ch.artificials.bubble.Main
Wonder if you guys have a working setup for that? I mean it should be similar for various projects but seems not. This part always frustrated me the most. I once had it working for jfx. And again trying around and getting frustrated… a lot.
Anyway if there is some gradle way to “easily” make it work I would be glad to know about it
Thanks for the pointers. The pain goes on.
And of course yet another java packer I’ll have a look if that is easier. But it is an installer, I tried that already. Similar results.
I adjusted it now to this
java -jar packr-all-4.0.0.jar --platform windows64 --jdk C:\Users\liesc.jdks\corretto-15.0.2 --executable MyGame --classpath lib\ --mainclass ch.artificials.bubble.Main --output MyGame_WinX64
This generates an executable that I can run and now errors… But it just eats up 100% CPU but nothing happens.
Not sure but is it only me who wants an executable? So nobody did that before? I mean how do you distribute the game if you only have jars and need the players to install JRE? And doesn’t this look samish for many jMonkey games?
EDIT: I searched the internet and not too much information there. What once worked was this java fx thing. But somehow this needs now a license or so.
I’ll put it now aside as I get so frustrated with that, after hours of trying, not a clue what it does not like. And the parameters are so limited, there is not room for a lot more trials. So I still hope for someone which managed it
Just in case somebody else is struggling with packr I found the solution I was just one wildcard away basically… well a bit more than that but here you go
The classpath must be lib\* not just lib. This puts everything next to the exec I mean jars and DLLs. And of course my asset folder as well. Hope this helps someone here.
Normally there is a way to put relative classpaths right into the main jar’s manifest but I don’t know if it works through the separate packr tool. (It would be dumb if it didn’t.)
I’m actually surprised there is not better support for the classpath manifest in newer tools. It was something I really missed coming from ant to gradle originally.