Module jdk.compiler

Defines the implementation of the system Java compiler and its command line equivalent, javac, as well as javah.


This module provides the equivalent of command-line access to javac via the ToolProvider and Tool service provider interfaces (SPIs), and more flexible access via the JavaCompiler SPI.

Instances of the tools can be obtained by calling ToolProvider.findFirst or the service loader with the name "javac".

In addition, instances of JavaCompiler.CompilationTask obtained from JavaCompiler can be downcast to JavacTask for access to lower level aspects of javac, such as the Abstract Syntax Tree (AST).

This module uses the FileSystemProvider API to locate file system providers. In particular, this means that a jar file system provider, such as that in the jdk.zipfs module, must be available if the compiler is to be able to read JAR files.


javah only exists as a command line tool, and does not provide any direct API. As of JDK 9, it has been deprecated. Use the -h option in javac instead.

Tool Guides:
javac, javah
Module Graph:
Module graph for jdk.compilerModule graph for jdk.compiler