jodd.compiler
Class JavaCompiler

java.lang.Object
  extended by jodd.compiler.JavaCompiler

public class JavaCompiler
extends java.lang.Object

Java compilation tool. Supports following compilers:

  • jikesw, jikes (disabled by default)
  • internal javac (from tools.jar)
  • external javac


    Field Summary
    protected  java.lang.String argDebug
               
    protected  java.lang.String argEncoding
               
    protected  java.lang.String argSource
               
    protected  java.lang.String argTarget
               
    protected  java.lang.String classpath
               
    protected static java.lang.String[] COMPILERS
               
    protected  java.lang.String compilerSpec
               
    protected  boolean haveToolsJar
               
    protected  boolean useJikes
               
     
    Constructor Summary
    JavaCompiler()
              Creates new java compiler.
     
    Method Summary
     void appendClasspath(java.lang.String... classpathItems)
              Add more classpath after default one.
     void compile(java.io.File sourceFile, java.lang.String className, java.io.File sourceDirectoryFile, java.io.File outputDirectoryFile)
               
     void compile(java.lang.String source)
               
     void setCompilerSpec(java.lang.String compiler)
              Specifies new java compiler specification.
     void setDebug(boolean debug)
              Sets debug argument.
     void setEncoding(java.lang.String encoding)
              Sets encoding.
     void setSourceVersion(java.lang.String source)
               
     void setTargetVersion(java.lang.String target)
               
     void setUseJikes(boolean useJikes)
              Enables or disables jikes compiler.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    COMPILERS

    protected static final java.lang.String[] COMPILERS

    classpath

    protected java.lang.String classpath

    compilerSpec

    protected java.lang.String compilerSpec

    argDebug

    protected java.lang.String argDebug

    argEncoding

    protected java.lang.String argEncoding

    argSource

    protected java.lang.String argSource

    argTarget

    protected java.lang.String argTarget

    haveToolsJar

    protected boolean haveToolsJar

    useJikes

    protected boolean useJikes
    Constructor Detail

    JavaCompiler

    public JavaCompiler()
    Creates new java compiler.

    Method Detail

    setCompilerSpec

    public void setCompilerSpec(java.lang.String compiler)
    Specifies new java compiler specification. By default it is set to -nowarn -sourcepath %s -d %d %f.

    The whole command line can be set in here, but it also can be set via properties of this class.


    setUseJikes

    public void setUseJikes(boolean useJikes)
    Enables or disables jikes compiler.


    appendClasspath

    public void appendClasspath(java.lang.String... classpathItems)
    Add more classpath after default one.


    setDebug

    public void setDebug(boolean debug)
    Sets debug argument.


    setEncoding

    public void setEncoding(java.lang.String encoding)
    Sets encoding. Not available on jikes.


    setSourceVersion

    public void setSourceVersion(java.lang.String source)

    setTargetVersion

    public void setTargetVersion(java.lang.String target)

    compile

    public void compile(java.lang.String source)
                 throws java.io.IOException
    Throws:
    java.io.IOException

    compile

    public void compile(java.io.File sourceFile,
                        java.lang.String className,
                        java.io.File sourceDirectoryFile,
                        java.io.File outputDirectoryFile)
                 throws java.io.IOException
    Throws:
    java.io.IOException


    Copyright © 2003-2012 Jodd Team