JME3 Create an exe file - doesn't work

Hey guys! Hope someone can help me :confused:

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 :flushed:




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)

but I have Java :confused: I have Java 14 or what you mean?

and if I select the last checkbox in the second screenshot the build failed and shows me the same error as before :see_no_evil:

I know it is no help, but it doesn’t work for me either. It has the same error when I do a build.

I even went into the dist and tried to manually run the >jar file and still got an error.

Hi,

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:

  1. Generate the .jar (clean and build of your working project)

  2. Download the right version of JDK (the one you set in Properties->Libraries->JavaPlatform). Click here for windows x64 and jdk11.

  3. Download this tool: packr-all-x.y.z.jar

  4. Now considering you have in the same folder:

    • Your distribution files ( all the files you are going to find into the “dist” folder after the build of the project )
    • The JDK .zip downloaded at the point 2
    • The file packr-all-x.y.z.jar downloaded at the point 3 (in the example below the 4.0.0 version)
  5. You just have to open a cmd into the folder of the previous point and run the follow command (it works for the standard project MyGame):

java -jar packr-all-4.0.0.jar \
     --platform windows64 \
     --jdk OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.zip \
     --useZgcIfSupportedOs \
     --executable MyGame \
     --classpath MyGame.jar \
     --mainclass mygame.Main \
     --vmargs Xmx2G \
     --resources lib \
     --output MyGame_WinX64

For a different project some values have to be changed, I strongly suggest to read here.

Keep in mind that in this way the project embedded the JDK and:

  • The size increase drastically;

  • The game will require more RAM.

I hope it could be useful :slight_smile:

The exception is NoSuchMethodError?

You’re using the wrong Java.

yes you were right, the engine platform was set to JDK11. So now I installed JDK11 on the laptop and deleted the old one (wrong version).

Unfortunately now I get a different error message when I want to open the jar-File:

c:\Users\alessa.foerster\Desktop\Test44\dist>java -jar MyGame.jar
Nov. 16, 2021 11:46:17 VORM. com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.3.2-SNAPSHOT

  • Branch: v3.3
  • Git Hash: 1ab3e92
  • 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:


→ no bunbled runtime and can not find system JRE

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.

BUILD FAILED (total time: 3 seconds)
:woozy_face:

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’

have tried it …unfortunately no

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. :upside_down_face:

But thanks for your answers :slightly_smiling_face:

any answer from here?
https://docs.oracle.com/javase/tutorial/deployment/selfContainedApps/index.html