Creating an executable JAR
Java archives are referred to as JAR files. These JAR files are the packages that contain the final bytecode generated from compiling the original source. There is a type of JAR file, called an executable JAR, which can be run by simply double clicking on the file as if it were any other Windows executable. The executable JAR contains a manifest file that describes the main entry point of the application, and it usually includes dependent libraries.
There are two primary methods for generating an executable JAR: using a Gradle target or creating an artifact with IntelliJ's IDEA IDE.
Gradle
The first method, using a Gradle target, can be implemented with the following steps:
Open up a command window and navigate to your project root directory where the
gradlew.bat
file lives. In Windows, holding down the left Shift key while pressing the right mouse button will add an option, Open Command Window Here, to the context window that pops up.Execute the following command...