All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.firefly.template.support.CompileUtils Maven / Gradle / Ivy

There is a newer version: 4.0.20
Show newest version
package com.firefly.template.support;

import java.util.LinkedList;
import java.util.List;

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

public class CompileUtils {
	public static int compile(String path, String classPath, String encoding, List files) {
		JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
		List params = new LinkedList();
		params.add("-encoding");
		params.add(encoding);
		params.add("-sourcepath");
		params.add(path);
		if(classPath != null) {
			params.add("-classpath");
			params.add(classPath);
		}
		params.addAll(files);
		return compiler.run(null, null, null, params.toArray(new String[0]));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy