javax.tools (Java SE 10 & JDK 10 ) (original) (raw)
Provides interfaces for tools which can be invoked from a program, for example, compilers.
These interfaces and classes are required as part of the Java™ Platform, Standard Edition (Java SE), but there is no requirement to provide any tools implementing them.
Unless explicitly allowed, all methods in this package might throw a NullPointerException if given anull
argument or if given alist or collection containingnull
elements. Similarly, no method may returnnull
unless explicitly allowed.
This package is the home of the Java programming language compiler framework. This framework allows clients of the framework to locate and run compilers from programs. The framework also provides Service Provider Interfaces (SPI) for structured access to diagnostics (DiagnosticListener) as well as a file abstraction for overriding file access (JavaFileManager and JavaFileObject). See JavaCompiler for more details on using the SPI.
There is no requirement for a compiler at runtime. However, if a default compiler is provided, it can be located using theToolProvider, for example:
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
It is possible to provide alternative compilers or tools through the service provider mechanism.
For example, if com.vendor.VendorJavaCompiler
is a provider of the JavaCompiler
tool then its jar file would contain the file META-INF/services/javax.tools.JavaCompiler
. This file would contain the single line:
com.vendor.VendorJavaCompiler
If the jar file is on the class path, VendorJavaCompiler can be located using code like this:
JavaCompiler compiler = ServiceLoader.load(JavaCompiler.class).iterator().next();
Since:
1.6
- Interface Summary
Interface Description Diagnostic Interface for diagnostics from tools. DiagnosticListener Interface for receiving diagnostics from tools. DocumentationTool Interface to invoke Java™ programming language documentation tools from programs. DocumentationTool.DocumentationTask Interface representing a future for a documentation task. FileObject File abstraction for tools. JavaCompiler Interface to invoke Java™ programming language compilers from programs. JavaCompiler.CompilationTask Interface representing a future for a compilation task. JavaFileManager File manager for tools operating on Java™ programming language source and class files. JavaFileManager.Location Interface for locations of file objects. JavaFileObject File abstraction for tools operating on Java™ programming language source and class files. OptionChecker Interface for recognizing options. StandardJavaFileManager File manager based on java.io.File and java.nio.file.Path. StandardJavaFileManager.PathFactory Factory to create Path objects from strings. Tool Common interface for tools that can be invoked from a program. - Class Summary
Class Description DiagnosticCollector Provides an easy way to collect diagnostics in a list. ForwardingFileObject<F extends FileObject> Forwards calls to a given file object. ForwardingJavaFileManager<M extends JavaFileManager> Forwards calls to a given file manager. ForwardingJavaFileObject<F extends JavaFileObject> Forwards calls to a given file object. SimpleJavaFileObject Provides simple implementations for most methods in JavaFileObject. ToolProvider Provides methods for locating tool providers, for example, providers of compilers. - Enum Summary
Enum Description Diagnostic.Kind Kinds of diagnostics, for example, error or warning. DocumentationTool.Location Locations specific to DocumentationTool. JavaFileObject.Kind Kinds of JavaFileObjects. StandardLocation Standard locations of file objects.
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2018, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.