liveBook · Manning

JAR file

As explained in Fast by Default

A JAR file is a ZIP-based Java archive that packages class files, resources, metadata, and optionally dependencies.

A JAR file packages Java application dependencies and can conceal substantial size from unused libraries, reflective code, embedded assets, and platform-specific native binaries. section 8.2.2

Analyze JAR size systematically:

  • Inspect dependency trees to identify transitive libraries and the versions selected by the build. section 8.2.2
  • Unpack Spring Boot’s single JAR and sort BOOT-INF/lib contents by size. section 8.2.2
  • Check for unused declared dependencies, reflective libraries, embedded assets, and native binaries bundled for unsupported platforms. section 8.2.2
du -sh BOOT-INF/lib/* | sort -h | tail -20

Sorts Spring Boot library contents by size, exposing the largest contributors to the application JAR. section 8.2.2

How Fast by Default covers it

How deep it goes
Explains dependency contents, size inspection, transitive paths, unused declarations, reflection, and native binaries.
Examples
Uses Gradle dependency reports, Maven dependency commands, Spring Boot archive listings, jdeps, and the Nebula Lint plugin.
What it assumes
Assumes familiarity with Java applications and build tools while explaining dependency paths and archive inspection.
What you can do after
Diagnose oversized JARs and choose lighter dependencies or platform-specific native packages.
How it connects
Connects JAR files with Gradle, Maven, Spring Boot, reflection, JNI, native binaries, and Java modules.

Also explained in

Compare how 2 books explain JAR file →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast by Default. The section links point to the parts of the book it draws on.