Excelsior JET and libGDX - sinistersnare/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!

  1. Package your libGDX application as an executable Jar for the desktop via Gradle
  2. 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.)
  3. Open Excelsior JET and create a new "Plain Java SE" project
  4. Specify the output folder "Application's working directory", which should already contain your app's Jar file as generated by Gradle
  5. 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!
  6. Click the Next button (right arrow, bottom right corner)
  7. 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.
  8. Click the Next button
  9. 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!
  10. Click the Next button
  11. Leave everything as is, except for maybe the maximum heap size
  12. Click the Next button
  13. Set the executable name, leave the rest as is, click the Next button
  14. 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 with javaw.) Click the Next button.
  15. 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.
  16. Wait for your app to be compiled/packaged to a native executable!
  17. After compilation, try out your native executable.
  18. 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.

⚠️ **GitHub.com Fallback** ⚠️