duke@1: /* ohair@554: * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this duke@1: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. duke@1: */ duke@1: duke@1: /** duke@1: * Provides interfaces for tools which can be invoked from a program, duke@1: * for example, compilers. duke@1: * duke@1: *

These interfaces and classes are required as part of the duke@1: * Java™ Platform, Standard Edition (Java SE), duke@1: * but there is no requirement to provide any tools implementing them. duke@1: * duke@1: *

Unless explicitly allowed, all methods in this package might duke@1: * throw a {@linkplain java.lang.NullPointerException} if given a duke@1: * {@code null} argument or if given a duke@1: * {@linkplain java.lang.Iterable list or collection} containing duke@1: * {@code null} elements. Similarly, no method may return duke@1: * {@code null} unless explicitly allowed. duke@1: * duke@1: *

This package is the home of the Java programming language compiler framework. This duke@1: * framework allows clients of the framework to locate and run duke@1: * compilers from programs. The framework also provides Service duke@1: * Provider Interfaces (SPI) for structured access to diagnostics duke@1: * ({@linkplain javax.tools.DiagnosticListener}) as well as a file duke@1: * abstraction for overriding file access ({@linkplain duke@1: * javax.tools.JavaFileManager} and {@linkplain duke@1: * javax.tools.JavaFileObject}). See {@linkplain duke@1: * javax.tools.JavaCompiler} for more details on using the SPI. duke@1: * duke@1: *

There is no requirement for a compiler at runtime. However, if duke@1: * a default compiler is provided, it can be located using the duke@1: * {@linkplain javax.tools.ToolProvider}, for example: duke@1: * duke@1: *

{@code JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();} duke@1: * duke@1: *

It is possible to provide alternative compilers or tools duke@1: * through the {@linkplain java.util.ServiceLoader service provider duke@1: * mechanism}. duke@1: * duke@1: *

For example, if {@code com.vendor.VendorJavaCompiler} is a duke@1: * provider of the {@code JavaCompiler} tool then its jar file duke@1: * would contain the file {@code duke@1: * META-INF/services/javax.tools.JavaCompiler}. This file would duke@1: * contain the single line: duke@1: * duke@1: *

{@code com.vendor.VendorJavaCompiler} duke@1: * duke@1: *

If the jar file is on the class path, VendorJavaCompiler can be duke@1: * located using code like this: duke@1: * duke@1: *

{@code JavaCompiler compiler = ServiceLoader.load(JavaCompiler.class).iterator().next();} duke@1: * duke@1: * @author Peter von der Ahé duke@1: * @author Jonathan Gibbons duke@1: * @since 1.6 duke@1: */ duke@1: package javax.tools;