Klasse RtCompiler

java.lang.Object
com.github.hypfvieh.java.rtcompiler.BaseCompiler
com.github.hypfvieh.java.rtcompiler.RtCompiler

public class RtCompiler extends BaseCompiler
Helper class to compile java sources.

Seit:
1.0.0 - 2024-01-25
Autor:
hypfvieh
  • Konstruktordetails

    • RtCompiler

      public RtCompiler()
      Creates a new compiler.
  • Methodendetails

    • setDebuggingInformation

      public void setDebuggingInformation(boolean _debugSource, boolean _debugLines, boolean _debugVars)
      Determines what kind of debugging information is included in the generates classes.
      Parameter:
      _debugSource - source name
      _debugLines - line information
      _debugVars - variable information
    • setCompileToMemory

      public void setCompileToMemory(boolean _compileToMemory)
      Toggle compiling to memory. Per default, compiling to memory is true as long as the process is not running in a debugger.
      Parameter:
      _compileToMemory - true to enable compile to memory, false to disable
    • setClasspath

      public void setClasspath(File[] _classPath)
      Set the classpath. Setting null resets the classpath to its default.
      Parameter:
      _classPath - new class path
    • compile

      public Set<String> compile(File _outputClassDir, File... _sourceFiles) throws CompileException, IOException
      Compiles the given source files and writes compilation result to target directory if compileToMemory is false.
      Parameter:
      _outputClassDir - output directory
      _sourceFiles - source files to read
      Gibt zurück:
      Set of FQCN created by the compiler
      Löst aus:
      CompileException - when compilation fails
      IOException - when reading source file fails
    • getClassLoader

      public ClassLoader getClassLoader()
      Returns the classloader containing the results of the last compile(File, File...) call.
      Gibt zurück:
      ClassLoader, maybe null