|
Web Site | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.janino.Compiler
A simplified substitute for the javac tool. Usage:
java org.codehaus.janino.Compiler \ [ -d destination-dir ] \ [ -sourcepath dirlist ] \ [ -classpath dirlist ] \ [ -extdirs dirlist ] \ [ -bootclasspath dirlist ] \ [ -encoding encoding ] \ [ -verbose ] \ [ -g:none ] \ [ -g:{lines,vars,source} ] \ [ -warn:pattern-list ] \ source-file ... java org.codehaus.janino.Compiler -help
Constructor Summary | |
Compiler(File[] optionalSourcePath,
File[] classPath,
File[] optionalExtDirs,
File[] optionalBootClassPath,
File optionalDestinationDirectory,
String optionalCharacterEncoding,
boolean verbose,
DebuggingInformation debuggingInformation,
StringPattern[] optionalWarningHandlePatterns,
boolean rebuild)
Initialize a JavaTM compiler with the given parameters. |
|
Compiler(ResourceFinder sourceFinder,
IClassLoader iClassLoader,
File optionalDestinationDirectory,
String optionalCharacterEncoding,
boolean verbose,
DebuggingInformation debuggingInformation,
StringPattern[] optionalWarningHandlePatterns,
boolean rebuild)
|
Method Summary | |
boolean |
compile(File[] sourceFiles)
Reads a set of JavaTM compilation units (a.k.a. |
static File |
getClassFile(String className,
File sourceFile,
File optionalDestinationDirectory)
Construct the name of a file that could store the byte code of the class with the given name. |
static void |
main(String[] args)
Command line interface. |
void |
setStoringClassFiles(boolean storingClassFiles)
When called with a false argument, then compilation
is not terminated, but generated class files are no longer
stored in files. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Compiler(File[] optionalSourcePath, File[] classPath, File[] optionalExtDirs, File[] optionalBootClassPath, File optionalDestinationDirectory, String optionalCharacterEncoding, boolean verbose, DebuggingInformation debuggingInformation, StringPattern[] optionalWarningHandlePatterns, boolean rebuild)
Classes are searched in the following order:
optionalBootClassPath
is null
:
optionalBootClassPath
is not null
:
optionalBootClassPath
optionalExtDirs
is not null
:
optionalExtDirs
classPath
optionalSourcePath
is null
:
classPath
optionalSourcePath
is not null
:
sourcePath
public Compiler(ResourceFinder sourceFinder, IClassLoader iClassLoader, File optionalDestinationDirectory, String optionalCharacterEncoding, boolean verbose, DebuggingInformation debuggingInformation, StringPattern[] optionalWarningHandlePatterns, boolean rebuild)
sourceFinder
- Finds extra Java compilation units that need to be compiled (a.k.a. "sourcepath")iClassLoader
- loads auxiliary IClass
es; e.g. new ClassLoaderIClassLoader(ClassLoader)
optionalDestinationDirectory
- where to store the .class
filesoptionalCharacterEncoding
- verbose
- debuggingInformation
- a combination of Java.DEBUGGING_...
optionalWarningHandlePatterns
- which warnings to reportrebuild
- forces recompilation of all source files, even if up-to-date class files existMethod Detail |
public static void main(String[] args)
public void setStoringClassFiles(boolean storingClassFiles)
false
argument, then compilation
is not terminated, but generated class files are no longer
stored in files.
public boolean compile(File[] sourceFiles) throws Scanner.ScanException, Parser.ParseException, CompileException, IOException
For example, if the source path comprises the directories "A/B" and "../C", then the source file for class "com.acme.Main" is searched in
compile(File[])
or if you invoke
compile(File[])
multiply: In the former case, the source
files may contain arbitrary references among each other (even circular
ones). In the latter case, only the source files on the source path
may contain circular references, not the sourceFiles
.
false
if compile errors have occurred
Scanner.ScanException
Parser.ParseException
CompileException
IOException
public static File getClassFile(String className, File sourceFile, File optionalDestinationDirectory)
If optionalDestinationDirectory
is non-null, the returned path is the
optionalDestinationDirectory
plus the package of the class (with dots replaced
with file separators) plus the class name plus ".class". Example:
"destdir/pkg1/pkg2/Outer$Inner.class"
If optionalDestinationDirectory
is null, the returned path is the
directory of the sourceFile
plus the class name plus ".class". Example:
"srcdir/Outer$Inner.class"
className
- E.g. "pkg1.pkg2.Outer$Inner"sourceFile
- E.g. "srcdir/Outer.java"optionalDestinationDirectory
- E.g. "destdir"
|
Web Site | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |