APIdia Launch Partner
Top Description Fields Constructors Methods
javax.tools

public Class ToolProvider

extends Object
Class Inheritance
Imports
java.util.Objects, .ServiceConfigurationError, .ServiceLoader

Provides methods for locating tool providers, for example, providers of compilers. This class complements the functionality of java.util.ServiceLoader.
Since
1.6

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static DocumentationTool

Returns:

the documentation tool provided with this platform or null if no documentation tool is provided
getSystemDocumentationTool
()

Returns the Java programming language documentation tool provided with this platform.

public static JavaCompiler

Returns:

the compiler provided with this platform or null if no compiler is provided
getSystemJavaCompiler
()

Returns the Java programming language compiler provided with this platform.

private static <
the interface of the tool
T
>
T

Returns:

the specified implementation of the tool
getSystemTool
(Class<T>
the interface of the tool
clazz
,
String
the name of the module containing the desired implementation
moduleName
,
String
the class name of the desired implementation
className
)

Get an instance of a system tool using the service loader.

public static ClassLoader

Returns:

a class loader, or null
getSystemToolClassLoader
()
Deprecated since 9. This method is subject to removal in a future version of Java SE.

Returns a class loader that may be used to load system tools, or null if no such special loader is provided.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

systemDocumentationToolModuleback to summary
private static final String systemDocumentationToolModule
systemDocumentationToolNameback to summary
private static final String systemDocumentationToolName
systemJavaCompilerModuleback to summary
private static final String systemJavaCompilerModule
systemJavaCompilerNameback to summary
private static final String systemJavaCompilerName

Constructor Detail

ToolProviderback to summary
private ToolProvider()

Method Detail

getSystemDocumentationToolback to summary
public static DocumentationTool getSystemDocumentationTool()

Returns the Java programming language documentation tool provided with this platform.

The file manager returned by calling getStandardFileManager on this tool supports paths provided by any filesystem.

Implementation Note

This implementation returns the tool provided by the jdk.javadoc module if that module is available, and null otherwise.

Returns:DocumentationTool

the documentation tool provided with this platform or null if no documentation tool is provided

getSystemJavaCompilerback to summary
public static JavaCompiler getSystemJavaCompiler()

Returns the Java programming language compiler provided with this platform.

The file manager returned by calling getStandardFileManager on this compiler supports paths provided by any filesystem.

Implementation Note

This implementation returns the compiler provided by the jdk.compiler module if that module is available, and null otherwise.

Returns:JavaCompiler

the compiler provided with this platform or null if no compiler is provided

getSystemToolback to summary
private static <T> T getSystemTool(Class<T> clazz, String moduleName, String className)

Get an instance of a system tool using the service loader.

Implementation Note

By default, this returns the implementation in the specified module. For limited backward compatibility, if this code is run on an older version of the Java platform that does not support modules, this method will try and create an instance of the named class. Note that implies the class must be available on the system class path.

Parameters
<T>
the interface of the tool
clazz:Class<T>

the interface of the tool

moduleName:String

the name of the module containing the desired implementation

className:String

the class name of the desired implementation

Returns:T

the specified implementation of the tool

getSystemToolClassLoaderback to summary
public static ClassLoader getSystemToolClassLoader()

Deprecated

since 9.

This method is subject to removal in a future version of Java SE. Use the system tool provider or service loader mechanisms to locate system tools as well as user-installed tools.

Returns a class loader that may be used to load system tools, or null if no such special loader is provided.

Implementation Specification

This implementation always returns null.

Returns:ClassLoader

a class loader, or null

Annotations
@Deprecated
since:9