Skip to main content
The OpenJDK provides a comprehensive suite of development tools for compiling, linking, packaging, and diagnosing Java applications. These tools are essential for building and maintaining Java applications.

Compiler Tools

javac - Java Compiler

The Java programming language compiler, located in the jdk.compiler module. javac reads Java source files and compiles them into bytecode class files. Key Features:
  • Supports all Java language features and versions
  • Module system support with --module-path and --add-modules
  • Annotation processing with -processor
  • Extensive lint warnings with -Xlint
  • Integration with Java Platform Module System (JPMS)
Learn more about javac

Linking and Packaging Tools

Creates custom runtime images by assembling and optimizing a set of modules and their dependencies. Part of the jdk.jlink module. Key Features:
  • Creates minimal runtime images with only required modules
  • Plugin architecture for image optimization
  • Platform-specific image generation
  • Launcher script generation
Learn more about jlink

jpackage - Java Packaging Tool

Packages Java applications into native installers for various platforms. Located in the jdk.jpackage module. Key Features:
  • Creates platform-specific installers (MSI, DEB, RPM, DMG, PKG)
  • Application image bundling
  • Runtime inclusion
  • Icon and metadata customization
Learn more about jpackage

Diagnostic Tools

jcmd - JVM Diagnostic Command Tool

Sends diagnostic command requests to running Java Virtual Machine processes. Part of the jdk.jcmd module. Key Features:
  • Attach to running JVM processes
  • Execute diagnostic commands
  • Performance counter inspection
  • Thread dumps and heap analysis
Learn more about jcmd

Tool Organization

All JDK tools are organized into modules following the Java Platform Module System:
jdk.compilerContains the Java compiler implementation:
  • com.sun.tools.javac.Main - Main entry point
  • com.sun.tools.javac.main.Option - Command-line options
  • com.sun.tools.javac.main.JavaCompiler - Core compiler logic

Common Usage Patterns

Build Pipeline

A typical Java application build pipeline uses these tools in sequence:
# 1. Compile source code
javac -d build/classes --module-source-path src $(find src -name '*.java')

# 2. Create custom runtime image
jlink --module-path $JAVA_HOME/jmods:build/classes \
      --add-modules myapp \
      --output myapp-runtime

# 3. Package as native installer
jpackage --type deb \
         --app-version 1.0 \
         --runtime-image myapp-runtime \
         --name MyApp

Diagnostic Workflow

# List running Java processes
jcmd -l

# Get VM info for specific process
jcmd <pid> VM.version

# Generate thread dump
jcmd <pid> Thread.print

# Check performance counters
jcmd <pid> PerfCounter.print

Source Code Locations

All tool implementations are located in src/ directory:
  • javac: src/jdk.compiler/share/classes/com/sun/tools/javac/
  • jlink: src/jdk.jlink/share/classes/jdk/tools/jlink/
  • jpackage: src/jdk.jpackage/share/classes/jdk/jpackage/
  • jcmd: src/jdk.jcmd/share/classes/sun/tools/jcmd/
All tools support the --help or -h option to display usage information and available commands.

Next Steps

Explore detailed documentation for each tool:

Build docs developers (and LLMs) love