javax.tools
Interface Tool

All Known Subinterfaces:
DisassemblerTool, JavaCompiler
All Known Implementing Classes:
JavacTool

public interface Tool

Common interface for tools that can be invoked from a program. A tool is traditionally a command line program such as a compiler. The set of tools available with a platform is defined by the vendor.

Tools can be located using java.util.ServiceLoader#load(Class).

Since:
1.6

Method Summary
 java.util.Set<SourceVersion> getSourceVersions()
          Gets the source versions of the Java™ programming language supported by this tool.
 int run(java.io.InputStream in, java.io.OutputStream out, java.io.OutputStream err, java.lang.String... arguments)
          Run the tool with the given I/O channels and arguments.
 

Method Detail

run

int run(java.io.InputStream in,
        java.io.OutputStream out,
        java.io.OutputStream err,
        java.lang.String... arguments)
Run the tool with the given I/O channels and arguments. By convention a tool returns 0 for success and nonzero for errors. Any diagnostics generated will be written to either out or err in some unspecified format.

Parameters:
in - "standard" input; use System.in if null
out - "standard" output; use System.out if null
err - "standard" error; use System.err if null
arguments - arguments to pass to the tool
Returns:
0 for success; nonzero otherwise
Throws:
java.lang.NullPointerException - if the array of arguments contains any null elements.

getSourceVersions

java.util.Set<SourceVersion> getSourceVersions()
Gets the source versions of the Java™ programming language supported by this tool.

Returns:
a set of supported source versions