public class JavaCompilerUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<java.lang.String> |
_args |
protected java.lang.String |
_charEncoding |
Modifier and Type | Method and Description |
---|---|
void |
compile(java.lang.String fileName,
LineMap lineMap)
Compiles the class.
|
void |
compile(java.lang.String fileName,
LineMap lineMap,
boolean ifModified)
Compiles the class.
|
void |
compileBatch(java.lang.String[] files)
Compiles a batch list of classes.
|
void |
compileIfModified(java.lang.String fileName,
LineMap lineMap)
Compiles the class.
|
protected void |
compileInt(java.lang.String[] path,
LineMap lineMap) |
static JavaCompilerUtil |
create()
Creates a new compiler.
|
static JavaCompilerUtil |
create(java.lang.ClassLoader loader)
Creates a new compiler.
|
java.util.ArrayList<java.lang.String> |
getArgs()
Returns the ArrayList of arguments.
|
java.lang.ClassLoader |
getClassLoader()
Sets the class loader used to load the compiled class and to grab
the classpath from.
|
java.lang.String |
getClassPath()
Returns the classpath.
|
java.lang.String |
getCompiler()
Gets the compiler name, e.g.
|
java.lang.String |
getEncoding()
Returns the encoding.
|
long |
getMaxCompileTime()
Returns the maximum time allowed for an external compilation.
|
Path |
getSourceDir()
Returns the directory where compiled classes go.
|
java.lang.String |
getSourceExtension()
Gets the source extension.
|
long |
getStartTimeout()
Returns the thread spawn time for an external compilation.
|
static java.lang.String |
mangleName(java.lang.String name)
Mangles the path into a valid Java class name.
|
void |
mergeSmap(Path classPath,
Path smapPath) |
void |
setArgs(java.util.ArrayList<java.lang.String> args) |
void |
setArgs(java.lang.String argString)
Sets any additional arguments for the compiler.
|
void |
setClassDir(Path path)
Sets the directory where compiled classes go.
|
void |
setClassLoader(java.lang.ClassLoader loader)
Sets the class loader used to load the compiled class and to grab
the classpath from.
|
void |
setClassPath(java.lang.String classPath)
Sets the class path for compilation.
|
void |
setCompileParent(boolean compileParent) |
void |
setCompiler(java.lang.String compiler)
Sets the compiler name, e.g.
|
void |
setEncoding(java.lang.String encoding)
Sets the Java encoding for the compiler.
|
void |
setExtraClassPath(java.lang.String classPath)
Sets an extra class path for compilation.
|
void |
setMaxBatch(int maxBatch)
Sets the maximum time allowed for an external compilation.
|
void |
setMaxCompileTime(long maxCompileTime)
Sets the maximum time allowed for an external compilation.
|
void |
setSourceDir(Path path)
Sets the directory the java source comes from.
|
void |
setSourceExtension(java.lang.String ext)
Sets the source extension.
|
void |
setStartTimeout(long startTimeout)
Sets the thread spawn time for an external compilation.
|
protected java.lang.String _charEncoding
protected java.util.ArrayList<java.lang.String> _args
public static JavaCompilerUtil create()
public static JavaCompilerUtil create(java.lang.ClassLoader loader)
loader
- the parent class loader for the compiler.public void setClassLoader(java.lang.ClassLoader loader)
public java.lang.ClassLoader getClassLoader()
public void setCompiler(java.lang.String compiler)
public java.lang.String getCompiler()
public void setClassDir(Path path)
path
- representing the class dir.public void setSourceDir(Path path)
path
- representing the source dir.public Path getSourceDir()
public void setSourceExtension(java.lang.String ext)
public java.lang.String getSourceExtension()
public void setClassPath(java.lang.String classPath)
public void setExtraClassPath(java.lang.String classPath)
public void setCompileParent(boolean compileParent)
public java.lang.String getClassPath()
public void setArgs(java.lang.String argString)
public java.util.ArrayList<java.lang.String> getArgs()
public void setEncoding(java.lang.String encoding)
public java.lang.String getEncoding()
public long getStartTimeout()
public void setStartTimeout(long startTimeout)
public long getMaxCompileTime()
public void setMaxCompileTime(long maxCompileTime)
public void setMaxBatch(int maxBatch)
public static java.lang.String mangleName(java.lang.String name)
public void setArgs(java.util.ArrayList<java.lang.String> args)
public void compile(java.lang.String fileName, LineMap lineMap) throws java.io.IOException, java.lang.ClassNotFoundException
fileName
- Java source name -- in VFS formatlineMap
- mapping from generated class back to the source classjava.io.IOException
java.lang.ClassNotFoundException
public void compileIfModified(java.lang.String fileName, LineMap lineMap) throws java.io.IOException, java.lang.ClassNotFoundException
fileName
- Java source name -- in VFS formatlineMap
- mapping from generated class back to the source classjava.io.IOException
java.lang.ClassNotFoundException
public void compile(java.lang.String fileName, LineMap lineMap, boolean ifModified) throws java.io.IOException, java.lang.ClassNotFoundException
fileName
- Java source name -- in VFS formatlineMap
- mapping from generated class back to the source classifModified
- compile only if the *.java is modifiedjava.io.IOException
java.lang.ClassNotFoundException
public void compileBatch(java.lang.String[] files) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected void compileInt(java.lang.String[] path, LineMap lineMap) throws java.io.IOException, JavaCompileException
java.io.IOException
JavaCompileException