public final class FileCompiler
extends java.lang.Object
compileFiles(List)
that compiles Java source files. It invokes a
user-specified external command, such as javac
or jikes
.Modifier and Type | Field and Description |
---|---|
static java.lang.Runtime |
runtime
The Runtime of the JVM.
|
Constructor and Description |
---|
FileCompiler()
Creates a new FileCompiler.
|
FileCompiler(java.util.ArrayList<java.lang.String> compiler,
long timeLimit)
Creates a new FileCompiler.
|
FileCompiler(java.lang.String[] compiler,
long timeLimit)
Creates a new FileCompiler.
|
FileCompiler(java.lang.String compiler,
long timeLimit)
Creates a new FileCompiler.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
compileFiles(java.util.List<java.lang.String> fileNames)
Compiles the files given by fileNames.
|
public FileCompiler()
FileCompiler(String, long)
public FileCompiler(java.lang.String[] compiler, long timeLimit)
FileCompiler(String,long)
, this constructor
permits spaces and other special characters in the command and arguments.compiler
- an array of Strings representing a command that runs a Java compiler (it could
be the full path name or whatever is used on the commandline), plus any command-line
optionstimeLimit
- the maximum permitted compilation time, in msecpublic FileCompiler(java.util.ArrayList<java.lang.String> compiler, long timeLimit)
FileCompiler(String,long)
, this constructor
permits spaces and other special characters in the command and arguments.compiler
- a list of Strings representing a command that runs a Java compiler (it could be
the full path name or whatever is used on the commandline), plus any command-line optionstimeLimit
- the maximum permitted compilation time, in msecpublic FileCompiler(java.lang.String compiler, long timeLimit)
compiler
- a command that runs a Java compiler; for instance, it could be the full path
name or whatever is used on the commandline. It may contain command-line arguments, and is
split on spaces.timeLimit
- the maximum permitted compilation time, in msecpublic java.lang.String compileFiles(java.util.List<java.lang.String> fileNames) throws java.io.IOException
fileNames
- paths to the files to be compiled as Stringsjava.io.IOException
- if there is a problem reading a file