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