Backend Development 11 min read

Understanding Spring Boot Executable JAR Packaging and the Role of JarLauncher

This article explains how the spring-boot-maven-plugin creates a self‑contained executable JAR, describes its internal structure, the manifest configuration, and details the function of Spring Boot Loader classes such as JarLauncher and LaunchedURLClassLoader in launching the application.

Java Architect Essentials
Java Architect Essentials
Java Architect Essentials
Understanding Spring Boot Executable JAR Packaging and the Role of JarLauncher

Spring Boot provides the spring-boot-maven-plugin to package an application as an executable JAR. Adding the plugin to the <build><plugins> section of the pom enables creation of a fat JAR that contains the application classes, dependencies and Spring Boot loader classes.

The generated JAR has a specific internal layout: a META-INF folder with MANIFEST.MF , a lib directory with third‑party JARs, Spring Boot loader classes, and the application’s own classes.

The manifest’s Main-Class is org.springframework.boot.loader.JarLauncher . When the JAR is started with java -jar … , JarLauncher’s main method is invoked, which registers the custom URL protocol handler, builds a class loader from the lib entries, reads the Start-Class attribute and launches the application.

Spring Boot Loader defines several abstractions such as Launcher , Archive , JarFileArchive and LaunchedURLClassLoader . The latter overrides loadClass to first try a root class loader, then search locally in the JAR URLs, and finally delegate to the parent loader.

Custom URLs use the jar:file:/…!/ syntax and are handled by org.springframework.boot.loader.jar.Handler , allowing nested JARs and classes to be accessed inside the executable archive.

Overall, the plugin and the Spring Boot Loader together provide a self‑contained executable JAR that can be run directly, with a well‑defined class‑loading mechanism and clear separation of metadata, dependencies, loader code, and application code.

JavaSpring BootClass LoaderExecutable JARJarLauncherMaven plugin
Java Architect Essentials
Written by

Java Architect Essentials

Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.