Now Excelsior JET Has Got a Gradle Plugin Too

If you use Gradle to build your Java applications, read on to learn how to compile them down to optimized native executables by pasting a few lines into your Gradle script.

Just in case you came to this post without knowing what Excelsior JET is, let me introduce it briefly. Put simply, Excelsior JET is a tool that can compile your Java application into an optimized native executable for any of the major desktop platforms. Yes, you can fully compile your Java programs down to native code as if they were C++ programs! You might say, why? For a complete answer, look here, I would just like to note that reflection, JNI, dynamic class loading, etc., still work after native compilation, so you do not need to change anything in your Java application prior to using Excelsior JET.

If you are already an Excelsior JET user and also happen to use Gradle, then we have some good news for you: we have factored the common API out of the previously developed Excelsior JET Maven plugin, which in turn enabled us to quickly develop a Gradle plugin with the same capabilities. The plugin is available from Maven Central, so you can start using it right away.


By default, the plugin assumes that Excelsior JET is installed and can be found via the PATH environment variable. If that is the case, add the plugin dependency to the buildscript{} configuration of your build.gradle file:

buildscript {
    ext.jetPluginVersion = '0.7.0'
    repositories {
    dependencies {
        classpath "com.excelsiorjet:excelsior-jet-gradle-plugin:$jetPluginVersion"

and then apply and configure the plugin as follows:

  • If your project is a plain Java SE application, add:

    apply plugin: 'excelsiorJet'
    excelsiorJet {
        mainClass = ''

    setting the mainClass parameter to the name of your main class.

  • If your project is a Tomcat Web application, add:

    apply plugin: 'excelsiorJet'
    excelsiorJet {
        tomcat {
            tomcatHome ""

    setting the tomcatHome parameter to point to the master Tomcat installation — basically, a clean Tomcat instance that was never launched.

Issuing the following command will then initiate a native build of your application:

gradlew jetBuild

Upon successful compilation, the plugin copies the resulting executable and required Excelsior JET Runtime files into a separate directory that you may just copy to another computer that has neither Excelsior JET nor the Oracle JRE installed.

For complete usage instructions and reference, head over to the plugin home page.

Sample Project

To demonstrate the process and result of plugin usage, we have forked the Pax Britannica libGDX demo on GitHub, added the Excelsior JET plugin to its build.gradle file, and run it through Gradle to build native binaries for three platforms.

You can download the binaries from here:

or clone our project and build it yourself:

git clone
gradlew jetBuild

Your Feedback Is Needed!

Excelsior JET has a number of features that the Maven and Gradle plugins do not support yet.

Therefore, we’ve decided to treat this work as a micro-startup – release an MVP (minimal valuable prototype) first, and follow up with new versions as quickly as possible, adding more and more new features.

Moreover, we would like to develop the plugins based on your feedback. To facilitate this, we’ve published their source code on GitHub (Maven plugin, Gradle plugin). What does that mean to you?

  • First, that means that the plugins are free open source projects (GPLv3).
  • Then that means that you are most welcome to create issues on GitHub to request features or report bugs.
  • Moreover, you can develop the plugins with us! If you need some functionality that is not yet covered, and we are busy with other important features, you can develop that functionality and send us a pull request.
  • Finally, you may fork either plugin and customize it to your specific needs without sending pull requests to us.


Even though we are going to base the plugins development on your feedback in the future, we have our own short-term plan as well. So the next few releases will add the following features:

  • Windows services support
  • Multi-component support: building dependencies into separate native libraries to reuse them across multiple Gradle project builds so as to reduce overall compilation time
  • Code signing

Note that the order of appearance of these features is not fixed and can be adjusted based on your feedback.

What about the other build tools?

Indeed, we would like to enable easy usage of Excelsior JET with other build tools such as ANT and Ivy. Our choice of Maven and Gradle was based on the ZeroTurnAround survey. 68% of the respondents said they use Maven most often, with the number of Gradle lovers trailing at 16%. So we have decided to start with Maven and Gradle and then see if there is a demand from users of other build tools.

Categories: Excelsior JET, Open Source

Tags: , , ,

Comments are closed.