static S invokeEcj(S options) ctex { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter(writer); File optionsFile = File.createTempFile("javax", ""); saveTextFile(optionsFile, options); String[] args = { "@" + optionsFile.getPath() }; Class ecjClass = Class.forName("org.eclipse.jdt.internal.compiler.batch.Main"); Object main = newInstance(ecjClass, printWriter, printWriter, false); call(main, "compile", new Object[]{args}); int errors = (Integer) get(main, "globalErrorsCount"); S output = str(writer); if (errors != 0) { print(output); throw new RuntimeException("Java compiler returned errors."); } ret output; }