In the preceding sections, you saw how to interact with code in a scripting language. Now we turn to a different scenario: Java programs that compile Java code. There are quite a few tools that need to invoke the Java compiler, such as:
• Development environments
• Java teaching and tutoring programs
• Build and test automation tools
• Templating tools that process snippets of Java code, such as JavaServer Pages (JSP)
In the past, applications invoked the Java compiler by calling undocumented classes in the jdk
/lib/tools.jar library. As of Java SE 6, a public API for compilation is a part of the Java platform, and it is no longer necessary to use
tools.jar. This section explains the compiler API.