Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Apache Kafka JVM Classpath Assembly

From Leeroopedia


Knowledge Sources
Domains Operations, JVM_Configuration
Last Updated 2026-02-09 12:00 GMT

Overview

A classpath construction process that assembles all required JAR files from Kafka's modular build structure into a single JVM classpath.

Description

JVM Classpath Assembly scans Kafka's build output directories to collect all required JAR files into a classpath string. Kafka has a modular architecture with separate directories for core, clients, streams, tools, and Connect components. The assembly process iterates through each module's build/libs and build/dependant-libs directories, filtering out test, source, and javadoc JARs. The resulting classpath must be non-empty for the broker to start.

Usage

Use this principle when launching any Kafka JVM process. The classpath assembly ensures all required libraries are available regardless of which Kafka component is being started.

Theoretical Basis

The assembly follows a directory-scanning pattern:

  1. Base Directory Detection: Determine the Kafka installation root relative to the script location.
  2. Scala Version Resolution: Read the Scala version from gradle.properties to select version-specific JARs.
  3. Module Scanning: Iterate through each Kafka module directory, collecting JARs from build output.
  4. Filtering: Exclude test, source, and javadoc JARs unless explicitly requested via INCLUDE_TEST_JARS.
  5. Validation: Verify the classpath is non-empty before proceeding.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment