In my last blog post, I covered a new tool called jstall, which enables you to quickly check on a Java application. Because it was tiresome to always call the tool via java -jar jstall, I looked for a way to create executables directly from JARs, inspired by async-profiler’s build system. And I, of course, went down a rabbit hole. In this blog post, I’ll show you how use execjar to easily create your own executable JARs that you can execute directly on the command line while still being valid JARs.
TL;DR: execjar is a CLI and Maven plugin that enables you to create executables from JARs by just adding a few lines to your Maven file:
<plugin>
<groupId>me.bechberger</groupId>
<artifactId>execjar</artifactId>
<version>0.1.1</version>
<executions>
<execution>
<goals>
<goal>execjar</goal>
</goals>
</execution>
</executions>
</plugin>
When your project is called jstall, this creates an executable with the same name that you can execute directly via ./jstall.
Important: The resulting executable is compatible only with UNIX (Linux and macOS) environments.
However, before I delve into the in-depth configuration options of my new tool, I’d like to provide some background on its implementation.
Continue reading













