Class Compiler

  extended by 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.

Trevor Harmon

Constructor Summary
Compiler(String compiler, String classPath, String sourcePath, String outputDir)
          Creates a new Compiler object.
Method Summary
 Class compile(String sourceFile)
          Runs the compiler.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Compiler(String compiler,
                String classPath,
                String sourcePath,
                String outputDir)
         throws CompilerException
Creates a new Compiler object.

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.pathSeparator
sourcePath - the source path to pass to the compiler, with each directory separated by File.pathSeparator
outputDir - the directory in which to place compiled classes
CompilerException - if the output directory or any element of the class path or source path do not exist
Method Detail


public Class compile(String sourceFile)
              throws CompilerException
Runs the compiler.

sourceFile - a Java source file
a handle to the class file that the compiler created
CompilerException - if the compiler task failed or if a handle to the compiled class could not be created