Quick revision
The short answer
A Spring Boot executable jar holds our compiled classes in BOOT-INF/classes, every dependency as a nested jar in BOOT-INF/lib, and Boot's own loader classes at the root. Its manifest names Boot's JarLauncher as Main-Class and our application class as Start-Class. When we run java -jar app.jar, the JVM starts JarLauncher, which builds a class loader that can read the nested jars and then calls our main method; the loader exists because plain Java cannot load classes from a jar inside a jar. Since Boot 3.2 the rewritten launcher lives in org.springframework.boot.loader.launch.
What to remember
In this answer, we looked inside a Spring Boot executable jar: our classes in BOOT-INF/classes, dependencies as nested jars in BOOT-INF/lib, Boot's loader classes at the root, and a manifest whose Main-Class is JarLauncher and whose Start-Class is our application. We followed java -jar as the JVM starts the launcher, which builds a class loader able to read nested jars and then calls our main method, saw that the loader exists because plain Java cannot load jars inside jars, and noted that Boot 3.2 moved the rewritten launcher to org.springframework.boot.loader.launch.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
A Spring Boot executable jar holds our compiled classes in BOOT-INF/classes, every dependency as a nested jar in BOOT-INF/lib, and Boot's own loader classes at the root. Its manifest names Boot's JarLauncher as Main-Class and our application class as Start-Class. When we run java -jar app.jar, the JVM starts JarLauncher, which builds a class loader that can read the nested jars and then calls our main method; the loader exists because plain Java cannot load classes from a jar inside a jar. Since Boot 3.2 the rewritten launcher lives in org.springframework.boot.loader.launch.
Why this question is asked
Most of us run java -jar app.jar many times a day without looking inside. But the layout explains a whole family of problems: why java -cp app.jar fails, why some libraries that scan the classpath behave differently, how layered Docker images work, and why start-up can change between Boot versions. Interviewers ask this to check that we understand our deployment unit rather than treat it as magic. In this answer, we will look inside a real jar, read its manifest, follow what happens when it starts, see why the special loader is needed, and note what changed in Boot 3.2.
1Looking Inside the Jar
A jar is a zip file, so we can list it. This is a trimmed listing of a small web application built with Boot 3.5.
- META-INF/MANIFEST.MFMain-Class:
JarLauncher, Start-Class: our class - org/springframework/boot/loader/launcher and class loader, at the root
- BOOT-INF/classes/our compiled classes and resources
- BOOT-INF/lib/dependencies as nested jars
- BOOT-INF/classpath.idx, layers.idxclasspath order and layer split
5 layers, from the top down. Step through them one at a time.
Three areas matter. Our own classes and resources are under BOOT-INF/classes, not at the root. Our dependencies are under BOOT-INF/lib, each one still a complete jar file, not unpacked. And the only classes at the root are Boot's loader classes, which the build plugin copies in. classpath.idx records the order in which the nested jars are placed on the classpath, so the order is the same on every machine, and layers.idx describes how to split the jar into Docker layers.
2Reading the Manifest
The manifest is the file the JVM reads first when we use java -jar. It tells the JVM which class has the main method.
Notice the two entries. Main-Class is a standard manifest attribute, and the JVM only knows about it. Boot sets it to its own JarLauncher. Start-Class is an attribute that only Boot reads; it holds the class we wrote with @SpringBootApplication and a main method. The Maven or Gradle plugin finds that class and writes both entries during repackaging, so we never edit the manifest by hand.
3What Happens on java -jar app.jar
Now we can follow the start-up step by step. The JVM opens the jar, reads Main-Class, and loads JarLauncher from the root of the jar with the normal application class loader. That works because the loader classes are plain classes at the root.
JarLauncher then opens the same jar as an archive, reads the Spring-Boot-Classes and Spring-Boot-Lib entries, and collects the locations of BOOT-INF/classes and every jar in BOOT-INF/lib, in the order from classpath.idx. It creates a LaunchedClassLoader, a URLClassLoader subclass whose URLs point inside the outer jar, using a special URL format and handler that can read a nested jar directly without extracting it to disk. It sets this loader as the thread's context class loader, loads the Start-Class through it, and calls its main method with our arguments by reflection. From that moment on, SpringApplication.run() starts exactly as it would in the IDE, and every Spring, Tomcat and Jackson class is loaded through the launcher's class loader.
- JVM reads META-INF/MANIFEST.MFMain-Class =
JarLauncher - JVM loads JarLauncher from the jar rootplain class, normal class loader
- Launcher lists BOOT-INF/classes and BOOT-INF/liborder from
classpath.idx - Launcher creates LaunchedClassLoadercan read nested jars in place
- Launcher loads Start-Class and calls main()
com.acme.orders.OrdersApplication - SpringApplication.run() starts the context
6 steps in order. Play them, or step through them one at a time.
4Why Plain Java Needs Help With Nested Jars
The JDK's class loaders can read classes from a directory or from a jar file, but not from a jar that is itself stored inside another jar. A URL such as jar:file:/app.jar!/BOOT-INF/lib/spring-core.jar!/org/springframework/... has two levels of nesting, which the standard jar URL handler does not support. Setting Class-Path in the manifest does not help either, because that attribute refers to files next to the jar on disk, not entries inside it.
Before Boot, the usual answers were to ship a directory of jars with a start script, or to build an uber-jar with a tool like the Maven Shade plugin, which unpacks every dependency and merges all classes into one jar. Shading works but loses each library's own manifest and signature, and files with the same name, such as META-INF/services entries, must be merged by hand. Boot's loader keeps every dependency jar intact, so there is nothing to merge, at the cost of needing its own launcher.
5What Changed in Boot 3.2
Spring Boot 3.2 shipped a rewritten loader. The launcher classes moved from org.springframework.boot.loader to org.springframework.boot.loader.launch, and the code that reads nested jars was rebuilt on top of a new nested jar URL format and file system support. Builds produce the new layout automatically. The change matters mostly when something refers to the launcher by name: a Dockerfile or script that starts org.springframework.boot.loader.JarLauncher must be updated to the launch package, and Boot temporarily offered a classic loader option for compatibility (check your version for whether it still exists).
For day-to-day use nothing changes: java -jar app.jar works the same. The newer tooling also includes the tools jar mode, java -Djarmode=tools -jar app.jar, which can extract the jar into a normal directory of jars for faster start-up and for layered container images.
6Follow-up questions
Can we run the application without the launcher?
Yes, if the jar is extracted first. java -Djarmode=tools -jar app.jar extract produces a plain application jar plus a lib directory, with a normal Class-Path in its manifest, which runs with java -jar and no nested jar loading. This also starts a little faster and works well with class data sharing.
Why are our classes in BOOT-INF/classes and not at the root?
So that they are loaded by the launcher's class loader together with the dependencies. If they were at the root, the JVM's own class loader would load them, and they could not see the Spring classes in the nested jars, which are only visible to the launcher's loader.
What is the difference between JarLauncher and PropertiesLauncher?
JarLauncher uses a fixed layout, BOOT-INF/classes and BOOT-INF/lib. PropertiesLauncher reads its classpath from properties such as loader.path, so it can add external directories or jars, for example plugins, at start-up. It is selected by setting the layout to ZIP in the build plugin or by running it explicitly.
7Conclusion
In this answer, we looked inside a Spring Boot executable jar: our classes in BOOT-INF/classes, dependencies as nested jars in BOOT-INF/lib, Boot's loader classes at the root, and a manifest whose Main-Class is JarLauncher and whose Start-Class is our application. We followed java -jar as the JVM starts the launcher, which builds a class loader able to read nested jars and then calls our main method, saw that the loader exists because plain Java cannot load jars inside jars, and noted that Boot 3.2 moved the rewritten launcher to org.springframework.boot.loader.launch.
Open with
A Boot executable jar is a zip with three parts. Our compiled classes and resources are in BOOT-INF/classes, all dependencies are kept as complete nested jars in BOOT-INF/lib, and Boot's loader classes are copied to the root of the jar.
Then, if they want more
There are also index files: classpath.idx fixes the classpath order and layers.idx describes the Docker layers. The manifest has Main-Class set to Boot's JarLauncher, which is what the JVM starts, and Start-Class set to our application class, which only Boot reads. When I run java -jar, the JVM loads JarLauncher from the root with the normal class loader.
The launcher then collects BOOT-INF/classes and every nested jar, creates its own class loader that can read classes from jars inside the outer jar without extracting them, sets it as the context class loader, and calls our main method by reflection. From there Spring starts as usual.
The launcher exists because the JDK cannot load classes from a jar inside a jar, and Boot did not want to shade and merge every dependency into one jar. Since Boot 3.2 the loader was rewritten and the launcher moved to org.springframework.boot.loader.launch, which matters if a script names the launcher class directly.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Spring Boot 3.2
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Boot reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "What is inside a Spring Boot executable jar and how does java -jar app.jar start the...": https://scrivio-interview-library.netlify.app/spring-boot/packaging-and-deployment/b859eadabf/