Tool: run(InputStream in, OutputStream out, OutputStream err, String... arguments) : JavaCompiler « javax.tools « Java by API






Tool: run(InputStream in, OutputStream out, OutputStream err, String... arguments)

      

import java.io.IOException;

import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;

public class Main {
  public static void main(String args[]) throws IOException {
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    int results = compiler.run(null, null, null, "Foo.java");
    System.out.println("Success: " + (results == 0));
  }
}

   
    
    
    
    
    
  








Related examples in the same category

1.JavaCompiler: getStandardFileManager(DiagnosticListener arg0, Locale arg1, Charset arg2)
2.JavaCompiler: getTask(Writer arg0, JavaFileManager arg1, DiagnosticListener arg2, Iterable arg3, Iterable arg4, Iterable arg5)
3.CompilationTask: call()
4.JavaCompiler: isSupportedOption(String option)