|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.mit.ai.psg.jeva.CompileUnit
CompileUnit -- compile a Java compilation unit (i.e., contents of a .java file) in a string.
Requires access to temporary file space (via File.createTempFile) and currently uses the Sun Java Development Kit JDK1.2 sun.tools.javac compiler (preferrably by including jdk1.2/lib/tools.jar in the classpath, though if not there will try to invoke javac as a process, which requires javac in the command path).
| Constructor Summary | |
CompileUnit()
|
|
| Method Summary | |
static Class |
compile(String className,
String compilationUnit)
Write compilation unit out to temp, run javac compiler on it, and load className. |
static Class |
compile(String className,
String compilationUnit,
OutputStream outStream,
OutputStream errStream)
Write compilation unit out to temp, run javac compiler on it, and load className. |
static Class |
compileFileInTemp(String className)
Calls compileFileInTemp on class using System.out and System.err |
static Class |
compileFileInTemp(String className,
OutputStream outStream,
OutputStream errStream)
Calls java compiler on file previously written with writeCompilationUnitToTemp(String, String),
adding temp file space to classpath. |
static void |
writeCompilationUnitToTemp(String className,
String compilationUnit)
Write compilation unit to temp. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public CompileUnit()
| Method Detail |
public static Class compile(String className,
String compilationUnit)
className - full class name of class (e.g., myOrg.myPkg.MyClass)compilationUnit - java source code for class,
(e.g., contents of its .java file)
public static Class compile(String className,
String compilationUnit,
OutputStream outStream,
OutputStream errStream)
className - full class name of class (e.g., myOrg.myPkg.MyClass)compilationUnit - java source code for class,
(e.g., contents of its .java file)outStream - output stream for compiler messageserrStream - output stream for compiler messages
public static void writeCompilationUnitToTemp(String className,
String compilationUnit)
File.createTempFile(String, String, File).) Used for writing
out multiple compilation units that depend on each other before
compiling one.className - full class name of class (e.g., myOrg.myPkg.MyClass)compilationUnit - java source code for class,
(e.g., contents of its .java file)public static Class compileFileInTemp(String className)
public static Class compileFileInTemp(String className,
OutputStream outStream,
OutputStream errStream)
writeCompilationUnitToTemp(String, String),
adding temp file space to classpath.
First tries sun.tools.javac.Main (faster, in-process);
if that is not found, tries starting a "javac" command in a separate
process.className - full class name of previously written compilation unit
to compile.outStream - output stream for compiler messageserrStream - output stream for compiler messages
|
Copyright (c) 1996-1999 Massachusetts Institute of Technology Feedback: jeva-bugs@ai.mit.edu |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||