Compiler Tools
javac - Java Compiler
The Java programming language compiler, located in thejdk.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-pathand--add-modules - Annotation processing with
-processor - Extensive lint warnings with
-Xlint - Integration with Java Platform Module System (JPMS)
Linking and Packaging Tools
jlink - Java Linker
Creates custom runtime images by assembling and optimizing a set of modules and their dependencies. Part of thejdk.jlink module.
Key Features:
- Creates minimal runtime images with only required modules
- Plugin architecture for image optimization
- Platform-specific image generation
- Launcher script generation
jpackage - Java Packaging Tool
Packages Java applications into native installers for various platforms. Located in thejdk.jpackage module.
Key Features:
- Creates platform-specific installers (MSI, DEB, RPM, DMG, PKG)
- Application image bundling
- Runtime inclusion
- Icon and metadata customization
Diagnostic Tools
jcmd - JVM Diagnostic Command Tool
Sends diagnostic command requests to running Java Virtual Machine processes. Part of thejdk.jcmd module.
Key Features:
- Attach to running JVM processes
- Execute diagnostic commands
- Performance counter inspection
- Thread dumps and heap analysis
Tool Organization
All JDK tools are organized into modules following the Java Platform Module System:- Compiler Module
- Linking Module
- Packaging Module
- Diagnostic Module
jdk.compilerContains the Java compiler implementation:
com.sun.tools.javac.Main- Main entry pointcom.sun.tools.javac.main.Option- Command-line optionscom.sun.tools.javac.main.JavaCompiler- Core compiler logic
Common Usage Patterns
Build Pipeline
A typical Java application build pipeline uses these tools in sequence:Diagnostic Workflow
Source Code Locations
All tool implementations are located insrc/ 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.