Excelsior JET and libGDX - s76/libgdx GitHub Wiki
Excelsior JET enables you to distribute and deploy your Java™ applications as optimized native executables that start and work faster, do not depend on the JRE, and are as difficult to reverse engineer as if they were written in C++. Excelsior JET allows you to create native executables for Windows, Linux and Mac OS X.
This article runs you through the minimal amount of steps required to get your libGDX app compiled to a native executable with Excelsior JET!
- Package your libGDX application as an executable Jar for the desktop via Gradle
- Install Excelsior JET. You can start with the trial. If you are happy, buy a license (they also have a discount program for early-stage startups and other very small businesses and provide free licenses to authors of non-commercial projects.)
- Open Excelsior JET and create a new "Plain Java SE" project
- Specify the output folder "Application's working directory", which should already contain your app's Jar file as generated by Gradle
- Specify the command line
javaw -Xmx256m -jar yourapp.jar
. You can of course add or modify any VM parameters, though many HotSpot-specific ones are ignored. Your native app will run with the same parameters once packaged! - Click the
Next
button (right arrow, bottom right corner) - Perform a test run by hitting the
Run!
button and make sure your app works as intended. It may run a bit slower as Excelsior JET doesn't optimize anything at that point. - Click the
Next
button - Leave everything as is, click "Check consistency". You may get some unresolved import dependencies and some missing super classes. As long as these belong to libGDX or LWJGL, you are fine!
- Click the
Next
button - Leave everything as is, except for maybe the maximum heap size
- Click the
Next
button - Set the executable name, leave the rest as is, click the
Next
button - On Windows, set the Windows icon file (.ico) for the resulting EXE file, and make sure that
Hide console window
is checked unless you do want to see what the EXE will write to stdout. (That checkbox get checked for you only if the command line you specified on the first step began withjavaw
.) Click theNext
button. - Leave everything as is and hit
Build
. Save the configuration to your project's root folder. This will allow you to invoke the build from the command line, or load the settings into the Excelsior JET UI. - Wait for your app to be compiled/packaged to a native executable!
- After compilation, try out your native executable.
- In order to distribute your natively compiled Java app to your users, you need to package it together with Excelsior JET Runtime and any auxiliary files that you want to include - license, documentation, etc. You can click
Package
right after compilation, or invoke the JetPackII tool from Excelsior JET start menu folder.
... To be continued ...
You can and should deviate from this guide and experiment with all the optimization options Excelsior JET has to offer. These will increase the runtime performance and decrease the executable size when configured to fit your applications needs. For more information, consult the Excelsior JET documentation.