public class FileCompiler
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FileCompiler.FileCompilerException
Exception for errors during compilation using
FileCompiler. |
| Modifier and Type | Field and Description |
|---|---|
private javax.tools.JavaCompiler |
compiler
The compiler object.
|
private java.util.List<java.lang.String> |
options
The command-line options for running this compiler.
|
| Constructor and Description |
|---|
FileCompiler()
Creates a
FileCompiler with no command-line options. |
FileCompiler(java.util.List<java.lang.String> options)
Creates a
FileCompiler with the given command-line options. |
| Modifier and Type | Method and Description |
|---|---|
void |
compile(java.util.List<java.io.File> sourceFiles,
java.nio.file.Path destinationDir)
Compile the given source files, writing resulting class files to the destination directory.
|
void |
compile(java.nio.file.Path sourceFile,
java.nio.file.Path destinationDir)
Compile the given source file, writing resulting class files to the destination directory.
|
private final java.util.List<java.lang.String> options
private final javax.tools.JavaCompiler compiler
public FileCompiler()
FileCompiler with no command-line options.public FileCompiler(java.util.List<java.lang.String> options)
FileCompiler with the given command-line options.options - the command-line
arguments for the JavaCompilerpublic void compile(java.util.List<java.io.File> sourceFiles,
java.nio.file.Path destinationDir)
throws FileCompiler.FileCompilerException
sourceFiles - the Java source filesdestinationDir - the destination directory for class filesFileCompiler.FileCompilerException - if the compilation failspublic void compile(java.nio.file.Path sourceFile,
java.nio.file.Path destinationDir)
throws FileCompiler.FileCompilerException
sourceFile - the Java source filedestinationDir - the destination directory for class filesFileCompiler.FileCompilerException - if the compilation fails