Build a desktop jar or an exe file

Hello i learn this

But my ide version not have application section

Please help how to buil game jar or exe file?

There is a build button (the one with the cleaner and the hammer) next to the run for building, it builds a jar file on the dist directory…

1 Like

You are using Gradle, so those instructions don’t apply to you. But you are rightfully using Gradle instead of Ant for which the instructions are. Don’t change it :slight_smile:

You can do all kinds of fancy stuff (installers etc.) with Gradle, but this is out-of-the-box Gradle feature which I use:
Right click on the project, select Run Gradle → Tasks… and create task to create a distributable ZIP:


Then later on you can use it simply:

You should end up with .zip in \build\distributions.

You can Google Gradle and Netbeans separate or together to learn more advanced magic.

2 Likes

If you want to have a native installer for your target platform, jpackage is your friend - this is a standard tool in modern JDK versions.

4 Likes

Thanks i have zip file in /build/distributions
how to run it?

extract zip file
cd bin
and run sh file?

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: wildmagic/WildMagic has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)

I update java and project run

Extract the ZIP, there should be BAT file for Windows and was it that sh file for *nix? And your error is that your registered Java (in Windows, registered in the path) is older than the one you used to compile your app.

1 Like

i have directories
/game/
–/assets/
–/game/main class
app.getAssetManager().registerLocator(“./assets”, FileLocator.class);

how to add /assets/ folder to build zip acrhive?

i move all assets to resouces folder

1 Like

Ah yeah, there is that if you have similar structure than my project. I added separate FileLocator for the distribution. I don’t necessarily think this is the best way to do this. But you can copy from: