/* Now run javac on the *.java file */
/************************************/
category.debug("javac " + jFile );
// Process proc = rt.exec( "javac " + jFile );
// proc.waitFor();
Compiler compiler = CompilerFactory.getCompiler();
String outdir = null ;
String[] args = null ;
outdir = msgContext.getStrProp( Constants.MC_HOME_DIR );
if ( outdir == null ) outdir = f1.getParent();
if ( outdir == null ) outdir = "." ;
compiler.setClasspath(getDefaultClasspath(msgContext));
compiler.setDestination(outdir);
compiler.setFile(jFile);
boolean result = compiler.compile();
/* Delete the temporary *.java file and check return code */
/**********************************************************/
(new File(jFile)).delete();
if ( !result ) {
/* Delete the *class file - sometimes it gets created even */
/* when there are errors - so erase it so it doesn't */
/* confuse us. */
/***********************************************************/
(new File(cFile)).delete();
Document doc = XMLUtils.newDocument();
Element root = doc.createElementNS("", "Errors");
StringBuffer message = new StringBuffer("Error compiling ");
message.append(jFile);
message.append(":\n");
List errors = compiler.getErrors();
int count = errors.size();
for (int i = 0; i < count; i++) {
CompilerError error = (CompilerError) errors.get(i);
if (i > 0) message.append("\n");
message.append("Line ");