// map which holds compiled bytecode
Map<String, byte[]> byteCode = new HashMap<String, byte[]>();
// create the compiler
CompilerRequestor compilerRequestor = new CompilerRequestor(byteCode);
Compiler compiler = new Compiler(new NameEnvironment(sources, byteCode),
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
compilerOptions,
compilerRequestor,
new DefaultProblemFactory(Locale.getDefault()));
// source files must be wrapped with an eclipse CompilationUnit
List<ICompilationUnit> compilationUnits = new ArrayList<ICompilationUnit>(sources.size());
for (Map.Entry<String, File> entry : sources.entrySet()) {
compilationUnits.add(new CompilationUnit(entry.getKey(), entry.getValue()));
}
// compiler the soruce files
compiler.compile(compilationUnits.toArray(new ICompilationUnit[compilationUnits.size()]));
// report errors (ignore warnings)
int errorCount = 0;
if (compilerRequestor.hasErrors()) {
for (IProblem problem : compilerRequestor.getProblems()) {