A Java Gradle Capsule is a single standalone compiled .jar file which contains all the dependencies necessary for running a Java application.

We can follow  the steps below for creating a Capsule Template Project.

0. Install NetBeans 8.2 and Gradle Plugin

  • Open Netbeans and install the Gradle plugin by going to Tools -> Plugins -> Available Plugins

1. Create the Capsule Template Project

2. Edit the build.gradle file

  • highlighted lines are the new lines added to the default file

3. Use the new included Google Guava library

4. Build the Capsule .jar

  • For building the capsule file: right click on the project -> go to  Tasks and select the capsule option

  • In the output window we can see details about the build process, the path of the compiled capsule file is not shown, but we can find it easily using this formula: [ProjectPath]/build/libs/CapsuleTemplate.jar

  • For seeing the capsule in action we can open a terminal/command prompt window and execute the  .jar file using the command :

java -jar [CapsuleFilePath]

  • The generated capsule file is containing all the necessary dependencies and can be deployed and executed on any systems which supports Java


To Do in next version:

  • Create Bitbucket project and add download link
  • Add possibility to rename the TemplateProject and download the renamed version