org.codehaus.janino
Class SimpleCompiler
java.lang.Object
org.codehaus.janino.EvaluatorBase
org.codehaus.janino.SimpleCompiler
- public class SimpleCompiler
- extends EvaluatorBase
A simplified version of Compiler
that can compile only a single
compilation unit. (A "compilation unit" is the characters stored in a
".java" file.)
Opposed to a normal ".java" file, you can declare multiple public classes
here.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleCompiler
public SimpleCompiler(String optionalFileName,
Reader in)
throws IOException,
Scanner.ScanException,
Parser.ParseException,
CompileException
SimpleCompiler
public SimpleCompiler(String optionalFileName,
InputStream is)
throws IOException,
Scanner.ScanException,
Parser.ParseException,
CompileException
SimpleCompiler
public SimpleCompiler(String fileName)
throws IOException,
Scanner.ScanException,
Parser.ParseException,
CompileException
SimpleCompiler
public SimpleCompiler(Scanner scanner,
ClassLoader optionalParentClassLoader)
throws IOException,
Scanner.ScanException,
Parser.ParseException,
CompileException
- Parse a compilation unit from the given
Scanner
object and
compile it to a set of JavaTM classes.
- Parameters:
scanner
- Source of tokensoptionalParentClassLoader
- Loads referenced classes
main
public static void main(String[] args)
throws Exception
- Throws:
Exception
getClassLoader
public ClassLoader getClassLoader()
- Returns a
ClassLoader
object through which the previously compiled classes can
be accessed. This ClassLoader
can be used for subsequent calls to
SimpleCompiler(Scanner, ClassLoader)
in order to compile compilation units that
use types (e.g. declare derived types) declared in the previous one.