public interface Compiler
extends java.lang.AutoCloseable
It supports running a compiler as a remote process, like a server.
Created by covers1624 on 8/29/25.
| Modifier and Type | Interface and Description |
|---|---|
static class |
Compiler.CompileResult
The result of a compile operation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Release any resources and stop any sub-processes.
|
Compiler.CompileResult |
compile(java.net.URI sourceUri,
java.lang.String source,
java.util.List<java.lang.String> extraJavacArgs)
Request a compilation unit be compiled.
|
static Compiler |
forLocal(java.util.Collection<java.nio.file.Path> compileClasspath)
Create a wrapper around the Java compiler on the current jdk.
|
static Compiler |
of(java.nio.file.Path javaExecutable,
java.util.Collection<java.nio.file.Path> compileClasspath)
Start a remote Java compiler server.
|
static Compiler of(java.nio.file.Path javaExecutable, java.util.Collection<java.nio.file.Path> compileClasspath) throws java.io.IOException
javaExecutable - The Java executable of the jdk to use. Must have a compiler present.compileClasspath - The compile classpath to use.java.io.IOExceptionstatic Compiler forLocal(java.util.Collection<java.nio.file.Path> compileClasspath) throws java.io.IOException
compileClasspath - The compile classpath to use.java.io.IOExceptionCompiler.CompileResult compile(java.net.URI sourceUri, java.lang.String source, java.util.List<java.lang.String> extraJavacArgs)
sourceUri - The URI describing the location of the source file. Javac
expects that packages are present in this URI.source - The source content for the compilation unit being compiled.extraJavacArgs - Any additional Java arguments to provide.void close()
throws java.io.IOException
close in interface java.lang.AutoCloseablejava.io.IOException