edu.uci.eecs.doc.cascade.util
Class Compiler
java.lang.Object
edu.uci.eecs.doc.cascade.util.Compiler
public class Compiler
- extends Object
Invokes a given Java compiler on a given source file. Note that the Java Compiler API is not used and the compiler is instead executed directly. The reason is that configuring the Compiler API to use a custom compiler is extremely difficult.
- Author:
- Trevor Harmon
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Compiler
public Compiler(String compiler,
String classPath,
String sourcePath,
String outputDir)
throws CompilerException
- Creates a new Compiler object.
- Parameters:
compiler
- location of the compiler executable (e.g., /usr/bin/javac)classPath
- the class path to pass to the compiler, with each directory separated by File.pathSeparatorsourcePath
- the source path to pass to the compiler, with each directory separated by File.pathSeparatoroutputDir
- the directory in which to place compiled classes
- Throws:
CompilerException
- if the output directory or any element of the class path or source path do not exist
compile
public Class compile(String sourceFile)
throws CompilerException
- Runs the compiler.
- Parameters:
sourceFile
- a Java source file
- Returns:
- a handle to the class file that the compiler created
- Throws:
CompilerException
- if the compiler task failed or if a handle to the compiled class could not be created