Java Doc for Compiler.java in  » Scripting » jacl » org » codehaus » janino » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » jacl » org.codehaus.janino 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.codehaus.janino.Compiler

Compiler
public class Compiler (Code)
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
 

Inner Class :static class SimpleWarningHandler implements WarningHandler

Field Summary
final public static  ResourceCreatorCREATE_NEXT_TO_SOURCE_FILE
    
final public static  StringPattern[]DEFAULT_WARNING_HANDLE_PATTERNS
    
final public static  ResourceFinderFIND_NEXT_TO_SOURCE_FILE
    
final public static  FileNO_DESTINATION_DIRECTORY
    

Constructor Summary
public  Compiler(File[] optionalSourcePath, File[] classPath, File[] optionalExtDirs, File[] optionalBootClassPath, File destinationDirectory, String optionalCharacterEncoding, boolean verbose, EnumeratorSet debuggingInformation, StringPattern[] warningHandlePatterns, boolean rebuild)
     Initialize a JavaTM compiler with the given parameters.
public  Compiler(ResourceFinder sourceFinder, IClassLoader iClassLoader, ResourceFinder classFileFinder, ResourceCreator classFileCreator, String optionalCharacterEncoding, boolean verbose, EnumeratorSet debuggingInformation, WarningHandler optionalWarningHandler)
     To mimic the behavior of JAVAC with a missing "-d" command line option, pass Compiler.FIND_NEXT_TO_SOURCE_FILE as the classFileResourceFinder and Compiler.CREATE_NEXT_TO_SOURCE_FILE as the classFileResourceCreator.

If it is impossible to check whether an already-compiled class file exists, or if you want to enforce recompilation, pass ResourceFinder.EMPTY_RESOURCE_FINDER as the classFileResourceFinder.
Parameters:
  sourceFinder - Finds extra Java compilation units that need to be compiled (a.k.a.


Method Summary
public  booleancompile(File[] sourceFiles)
     Reads a set of JavaTM compilation units (a.k.a.
public  booleancompile(Resource[] sourceResources)
     See Compiler.compile(File[]) .
static  IClassLoadercreateJavacLikePathIClassLoader(File[] optionalBootClassPath, File[] optionalExtDirs, File[] classPath)
     Create an IClassLoader that looks for classes in the given "boot class path", then in the given "extension directories", and then in the given "class path".
public static  FilegetClassFile(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.

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".

public static  voidmain(String[] args)
     Command line interface.
public  voidsetCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler)
     Install a custom UnitCompiler.ErrorHandler .

Field Detail
CREATE_NEXT_TO_SOURCE_FILE
final public static ResourceCreator CREATE_NEXT_TO_SOURCE_FILE(Code)



DEFAULT_WARNING_HANDLE_PATTERNS
final public static StringPattern[] DEFAULT_WARNING_HANDLE_PATTERNS(Code)



FIND_NEXT_TO_SOURCE_FILE
final public static ResourceFinder FIND_NEXT_TO_SOURCE_FILE(Code)



NO_DESTINATION_DIRECTORY
final public static File NO_DESTINATION_DIRECTORY(Code)




Constructor Detail
Compiler
public Compiler(File[] optionalSourcePath, File[] classPath, File[] optionalExtDirs, File[] optionalBootClassPath, File destinationDirectory, String optionalCharacterEncoding, boolean verbose, EnumeratorSet debuggingInformation, StringPattern[] warningHandlePatterns, boolean rebuild)(Code)
Initialize a JavaTM compiler with the given parameters.

Classes are searched in the following order:

  • If optionalBootClassPath is null:
    • Through the system class loader of the JVM that runs JANINO
  • If optionalBootClassPath is not null:
    • Through the optionalBootClassPath
  • If optionalExtDirs is not null:
    • Through the optionalExtDirs
  • Through the classPath
  • If optionalSourcePath is null:
    • Through source files found on the classPath
  • If optionalSourcePath is not null:
    • Through source files found on the sourcePath

The file name of a class file that represents class "pkg.Example" is determined as follows:


See Also:   Compiler.DEFAULT_WARNING_HANDLE_PATTERNS



Compiler
public Compiler(ResourceFinder sourceFinder, IClassLoader iClassLoader, ResourceFinder classFileFinder, ResourceCreator classFileCreator, String optionalCharacterEncoding, boolean verbose, EnumeratorSet debuggingInformation, WarningHandler optionalWarningHandler)(Code)
To mimic the behavior of JAVAC with a missing "-d" command line option, pass Compiler.FIND_NEXT_TO_SOURCE_FILE as the classFileResourceFinder and Compiler.CREATE_NEXT_TO_SOURCE_FILE as the classFileResourceCreator.

If it is impossible to check whether an already-compiled class file exists, or if you want to enforce recompilation, pass ResourceFinder.EMPTY_RESOURCE_FINDER as the classFileResourceFinder.
Parameters:
  sourceFinder - Finds extra Java compilation units that need to be compiled (a.k.a. "sourcepath")
Parameters:
  iClassLoader - loads auxiliary IClasses; e.g. new ClassLoaderIClassLoader(ClassLoader)
Parameters:
  classFileFinder - Where to look for up-to-date class files that need not be compiled
Parameters:
  classFileCreator - Used to store generated class files
Parameters:
  optionalCharacterEncoding -
Parameters:
  verbose -
Parameters:
  debuggingInformation - a combination of Java.DEBUGGING_...
Parameters:
  optionalWarningHandler - used to issue warnings





Method Detail
compile
public boolean compile(File[] sourceFiles) throws Scanner.ScanException, Parser.ParseException, CompileException, IOException(Code)
Reads a set of JavaTM compilation units (a.k.a. "source files") from the file system, compiles them into a set of "class files" and stores these in the file system. Additional source files are parsed and compiled on demand through the "source path" set of directories.

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

A/B/com/acme/Main.java
../C/com/acme/Main.java
Notice that it does make a difference whether you pass multiple source files to Compiler.compile(File[]) or if you invoke Compiler.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.

This method must be called exactly once after object construction.

Compile errors are reported as described at Compiler.setCompileErrorHandler(UnitCompiler.ErrorHandler) .
Parameters:
  sourceFiles - Contain the compilation units to compile true for backwards compatibility (return value can safely be ignored)




compile
public boolean compile(Resource[] sourceResources) throws Scanner.ScanException, Parser.ParseException, CompileException, IOException(Code)
See Compiler.compile(File[]) .
Parameters:
  sourceResources - Contain the compilation units to compile true for backwards compatibility (return value can safely be ignored)



createJavacLikePathIClassLoader
static IClassLoader createJavacLikePathIClassLoader(File[] optionalBootClassPath, File[] optionalExtDirs, File[] classPath)(Code)
Create an IClassLoader that looks for classes in the given "boot class path", then in the given "extension directories", and then in the given "class path".

The default for the optionalBootClassPath is the path defined in the system property "sun.boot.class.path", and the default for the optionalExtensionDirs is the path defined in the "java.ext.dirs" system property.




getClassFile
public static File getClassFile(String className, File sourceFile, File optionalDestinationDirectory)(Code)
Construct the name of a file that could store the byte code of the class with the given name.

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"
Parameters:
  className - E.g. "pkg1.pkg2.Outer$Inner"
Parameters:
  sourceFile - E.g. "srcdir/Outer.java"
Parameters:
  optionalDestinationDirectory - E.g. "destdir"




main
public static void main(String[] args)(Code)
Command line interface.



setCompileErrorHandler
public void setCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler)(Code)
Install a custom UnitCompiler.ErrorHandler . The default UnitCompiler.ErrorHandler prints the first 20 compile errors to System.err and then throws a CompileException .

Passing null restores the default UnitCompiler.ErrorHandler .




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.