Compiler that implements all redundant API methods.
| Modifier and Type | Field and Description |
|---|---|
| protected File[] | bootClassPath
This is always non- |
| protected ResourceCreator | classFileCreator
Implements the "write side" of the JAVAC |
| protected ResourceFinder | classFileFinder
Implements the "read side" of the JAVAC |
| protected File[] | classPath
The classpath of the currently executing JRE. |
| protected ErrorHandler | compileErrorHandler
Stores the value configured with |
| protected boolean | debugLines
Implements the JAVAC |
| protected boolean | debugSource
Implements the JAVAC |
| protected boolean | debugVars
Implements the JAVAC |
| private static final boolean | |
| private static final Pattern | |
| protected File[] | extensionDirectories
The list of extension directories of the currently executing JRE. |
| public Charset | sourceCharset
Implements the JAVAC |
| protected ResourceFinder | sourceFinder
Implements the JAVAC |
| protected int | |
| protected int | |
| protected WarningHandler | warningHandler
Stores the value configured with |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | compile(File[]
Contain the compilation units to compile sourceFiles)Implements org. |
| public void | setBootClassPath(File[] directoriesAndArchives)
Implements org. --boot-class-path.
|
| public final void | setCharacterEncoding(String characterEncoding)
Implements org. |
| public final void | setClassFileCreator(ResourceCreator
Stores the generated class files (a.k.a. "-d"); special value classFileCreator)CREATE_NEXT_TO_SOURCE_FILE means "create each .class file in the same directory as
its source file"Implements org. ResourceCreator is used to store generated .class files.
|
| public final void | setClassFileFinder(ResourceFinder destination, boolean rebuild)
Implements org. setClassFileFinder(rebuild ?
|
| public void | setClassFileFinder(ResourceFinder
Special value classFileFinder)FIND_NEXT_TO_SOURCE_FILE means ".class file is next to
its source file, not in the destination directory"Implements org. ResourceFinder is used to check whether a .class resource already exists and is younger
than the .java resource from which it was generated.
|
| public void | setClassPath(File[] directoriesAndArchives)
Implements org. |
| public void | setCompileErrorHandler(ErrorHandler
null to restore the default behavior (throwing a CompileException)Implements org. ErrorHandler which is invoked during compilation on each error.
|
| public void | setDebugLines(boolean value)
Implements org. -g:lines.
|
| public void | setDebugSource(boolean value)
Implements org. -g:source.
|
| public void | setDebugVars(boolean value)
Implements org. -g:vars.
|
| public final void | setDestinationDirectory(File
NO_DESTINATION_DIRECTORY means "create .class resources in
the directory of the .java resource from which they are generated"Implements org. -rebuild.
|
| public final void | setEncoding(Charset encoding)
Implements org. -encoding" command line option.
|
| public void | setExtensionDirectories(File[] directories)
Implements org. -extdirs.
|
| public void | setSourceCharset(Charset charset)
Implements org. setEncoding(Charset), but with a more precise name.
|
| public void | setSourceFinder(ResourceFinder sourceFinder)
Implements org. .java resources that need to be compiled, i.e. implements JAVAC's -sourcepath option.
|
| public void | setSourcePath(File[] directoriesAndArchives)
Implements org. --source-path.
|
| public void | setSourceVersion(int version)
Implements org. -source command line option.
|
| public void | setTargetVersion(int version)
Implements org. -target command line option.
|
| public void | setWarningHandler(WarningHandler
null to indicate that no warnings be issuedImplements org. WarningHandler.
|
| bootClassPath | back to summary |
|---|---|
| protected File[] bootClassPath This is always non- | |
| classFileCreator | back to summary |
|---|---|
| protected ResourceCreator classFileCreator Implements the "write side" of the JAVAC | |
| classFileFinder | back to summary |
|---|---|
| protected ResourceFinder classFileFinder Implements the "read side" of the JAVAC | |
| classPath | back to summary |
|---|---|
| protected File[] classPath The classpath of the currently executing JRE. | |
| compileErrorHandler | back to summary |
|---|---|
| protected ErrorHandler compileErrorHandler Stores the value configured with | |
| debugLines | back to summary |
|---|---|
| protected boolean debugLines Implements the JAVAC | |
| debugSource | back to summary |
|---|---|
| protected boolean debugSource Implements the JAVAC | |
| debugVars | back to summary |
|---|---|
| protected boolean debugVars Implements the JAVAC | |
| disassembleClassFilesToStdout | back to summary |
|---|---|
| private static final boolean disassembleClassFilesToStdout | |
| disassembleClassNames | back to summary |
|---|---|
| private static final Pattern disassembleClassNames | |
| extensionDirectories | back to summary |
|---|---|
| protected File[] extensionDirectories The list of extension directories of the currently executing JRE. Empty for Java 9+, because the system property "java.ext.dirs" is not set in JRE 9+. | |
| sourceCharset | back to summary |
|---|---|
| public Charset sourceCharset Implements the JAVAC | |
| sourceFinder | back to summary |
|---|---|
| protected ResourceFinder sourceFinder Implements the JAVAC | |
| sourceVersion | back to summary |
|---|---|
| protected int sourceVersion | |
| targetVersion | back to summary |
|---|---|
| protected int targetVersion | |
| warningHandler | back to summary |
|---|---|
| protected WarningHandler warningHandler Stores the value configured with | |
| AbstractCompiler | back to summary |
|---|---|
| public AbstractCompiler() | |
| compile | back to summary |
|---|---|
| public final boolean compile(File[] sourceFiles) throws CompileException, IOException Implements org. Doc from org. Reads a set of Java compilation units (a.k.a. "source files") from the file system, compiles them into a set of "class files" and stores these in the file system. Additional source files are parsed and compiled on demand through the "source path" set of directories. For example, if the source path comprises the directories "A/B" and "../C", then the source file for class "com.acme.Main" is searched in
Notice that it does make a difference whether you pass multiple source files to This method must be called exactly once after object construction.
Compile errors are reported as described at
| |
| setBootClassPath | back to summary |
|---|---|
| public void setBootClassPath(File[] directoriesAndArchives) Implements org. Doc from org. Equivalent of
| |
| setCharacterEncoding | back to summary |
|---|---|
| public final void setCharacterEncoding(String characterEncoding) Implements org.
| |
| setClassFileCreator | back to summary |
|---|---|
| public final void setClassFileCreator(ResourceCreator classFileCreator) Implements org. Doc from org. This
The default is, as for JAVAC,
| |
| setClassFileFinder | back to summary |
|---|---|
| public final void setClassFileFinder(ResourceFinder destination, boolean rebuild) Implements org. Doc from org. Equivalent with
| |
| setClassFileFinder | back to summary |
|---|---|
| public void setClassFileFinder(ResourceFinder classFileFinder) Implements org. Doc from org. This
If it is impossible to check whether an already-compiled class file exists, or if you want to enforce
recompilation, pass
The default is, as for JAVAC,
| |
| setClassPath | back to summary |
|---|---|
| public void setClassPath(File[] directoriesAndArchives) Implements org. Doc from org. Equivalent of --class-path.
| |
| setCompileErrorHandler | back to summary |
|---|---|
| public void setCompileErrorHandler(ErrorHandler compileErrorHandler) Implements org. Doc from org. Installs an
If the given
If the given
In other words: The
| |
| setDebugLines | back to summary |
|---|---|
| public void setDebugLines(boolean value) Implements org. Doc from org. Equivalent of
| |
| setDebugSource | back to summary |
|---|---|
| public void setDebugSource(boolean value) Implements org. Doc from org. Equivalent of
| |
| setDebugVars | back to summary |
|---|---|
| public void setDebugVars(boolean value) Implements org. Doc from org. Equivalent of
| |
| setDestinationDirectory | back to summary |
|---|---|
| public final void setDestinationDirectory(File destinationDirectory, boolean rebuild) Implements org. Doc from org. Equivalent of
-d and
Overrides any previously configured
| |
| setEncoding | back to summary |
|---|---|
| public final void setEncoding(Charset encoding) Implements org. Doc from org. The equivalent of JAVA's "
| |
| setExtensionDirectories | back to summary |
|---|---|
| public void setExtensionDirectories(File[] directories) Implements org. Doc from org. Equivalent of
| |
| setSourceCharset | back to summary |
|---|---|
| public void setSourceCharset(Charset charset) Implements org. Doc from org. Same as
| |
| setSourceFinder | back to summary |
|---|---|
| public void setSourceFinder(ResourceFinder sourceFinder) Implements org. Doc from org. Finds more
| |
| setSourcePath | back to summary |
|---|---|
| public void setSourcePath(File[] directoriesAndArchives) Implements org. Doc from org. Equivalent of
Equivalent with
| |
| setSourceVersion | back to summary |
|---|---|
| public void setSourceVersion(int version) Implements org. Doc from org. Specifies the version of source code accepted, in analogy with JAVAC's
| |
| setTargetVersion | back to summary |
|---|---|
| public void setTargetVersion(int version) Implements org. Doc from org. Generates class files that target a specified release of the virtual machine, in analogy with JAVAC's
| |
| setWarningHandler | back to summary |
|---|---|
| public void setWarningHandler(WarningHandler warningHandler) Implements org. Doc from org. By default, warnings are discarded, but an application my install a custom
| |