What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Yes, a Java compiler can help build a newer version of itself—but that is a build technique, not proof that the compiler is correct. OpenJDK starts with an existing JDK, uses it to build a new javac, then uses that compiler in later build stages. Separate regression tests provide another kind of validation.
Can javac compile itself?
In a qualified sense: the OpenJDK build uses an already available JDK to produce a new javac, then uses the newly built compiler to compile classes in a later phase. This is called bootstrapping. It breaks the apparent circle by starting with a working compiler from an earlier JDK rather than asking a compiler that does not yet exist to create itself.
The current OpenJDK build guide describes the JDK as able to build itself and says an up-to-date build of current JDK sources is an acceptable boot JDK. The guide’s broad point is that the project can build a new JDK from an existing one; the earlier langtools build description spells out the two-phase compiler sequence. That source-tree description is useful for understanding the mechanism, but its individual implementation details should not be assumed to apply unchanged to every modern JDK build.
How the compiler bootstrap works
- Start with a working boot JDK. It supplies Java tools, including a compiler capable of compiling the bootstrap-compatible source used at the start of the build.
- Build the new compiler. In the langtools build description, the first phase builds
javacand other tools using the boot JDK. This is the bootstrap phase. - Use the new compiler downstream. The description says required classes are compiled in the second phase with the latest
javacproduced in the first phase.
So “javac builds itself” is shorthand: an earlier JDK starts the process, and the newly built compiler participates in later compilation. It is not a compiler appearing from nowhere or compiling every part of its own build unaided.
Does self-compilation prove javac works?
No. A successful build shows that the new compiler can participate in that build’s later compilation stages. It does not, by itself, establish that the compiler handles every valid program correctly or that it is free of regressions. A build can succeed while defects remain in behaviors that the build did not exercise.
OpenJDK documents regression testing separately. Its Testing the JDK guide says most JDK tests use jtreg, a regression-test framework and runner, and identifies the javac compiler among the components covered by tier1, described as the fundamental test tier. The build and the test suite therefore answer different questions: can the compiler take part in building the JDK, and do regression tests exercise compiler behavior?
Rank #2
The cited documentation does not state a javac test count, coverage percentage, or pass rate. It also does not say that bootstrap compilation alone validates the compiler.
What javac is—and what it is not
javac is the Java source compiler, not the Java virtual machine. Oracle’s Java SE 26 documentation for the jdk.compiler module describes it as defining the system Java compiler implementation and its command-line equivalent, javac. The module also provides the JavaCompiler and ToolProvider APIs for invoking the compiler programmatically, along with the Compiler Tree API for working with source trees.
The javac command documentation covers compiling for earlier platform releases with options such as --release or --source and --target, subject to the constraints documented for those options. These compiler features are separate from the bootstrap process.
Was there a specific incident behind “its own test case”?
The phrase works as a metaphor for the relationship between building and testing javac: a newly built compiler is used in subsequent JDK compilation, while regression testing is handled separately. The official build and testing documents cited here describe those practices, but do not identify a dated historical incident in which javac literally became its own test case. Without evidence for a particular episode, it is more accurate to describe the build mechanism than to attach the phrase to an alleged event.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Recommended Free Tools

