Example usage for org.eclipse.jdt.internal.compiler.batch Main compile

List of usage examples for org.eclipse.jdt.internal.compiler.batch Main compile

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.batch Main compile.

Prototype

public static boolean compile(String[] commandLineArguments, PrintWriter outWriter, PrintWriter errWriter,
            CompilationProgress progress) 

Source Link

Usage

From source file:org.jnario.jnario.test.util.FeatureJavaCompiler.java

License:Open Source License

public void compile(List<String> files) {
    StringBuilder sb = new StringBuilder(getComplianceLevelArg());
    sb.append(" ");
    sb.append(getClasspathArgs());/*from w  w  w. ja  v a2  s.co m*/
    sb.append(" ");
    sb.append(Joiner.on(" ").join(files));
    OutputStream errorStream = new ByteArrayOutputStream();
    if (!Main.compile(Main.tokenize(sb.toString()), new PrintWriter(System.out), new PrintWriter(errorStream),
            new Progress())) {
        throw new IllegalArgumentException("Couldn't compile : " + errorStream.toString() + "\n");
    }
}