+ Standard.SPACE
+ compilerOpts
;
}
ExecutableCommand cmd = new ExecutableCommand( compiler, compilerOpts, sourceFiles );
String fullcmd = cmd.getFullCmd();
cmd.setUserMessageHandler( mUserMessageHandler );
cmd.setActivityDescription( UserText.get( UserText.TXT_compiling ) );
boolean successful = cmd.execute();
/*
( new ExecutableCommand.AlternativeExecutableCommands
(
// try jikes if javac not found and vice versa
new ExecutableCommand( JavaUtil.COMPILER_javac.equals( compiler ) ? JavaUtil.COMPILER_jikes : JavaUtil.COMPILER_javac,
compilerOpts, sourceFiles )
// try to use JAVA_HOME
,new ExecutableCommand( "JAVA_HOME/"+JavaUtil.COMPILER_javac, compilerOpts, sourceFiles ) {
public boolean execute( ExecutableCommand pParent ) {
ExecutableCommand jhc = new ExecutableCommand( "cmd", "/c echo %JAVA_HOME%" );
if( jhc.execute( new ExecutableCommand.AlternativeExecutableCommands
( new ExecutableCommand( "sh", "-c \"echo $JAVA_HOME\"" ) ) ) ) {
String javaHome = jhc.getOutResult().trim();
if( !Standard.EMPTY.equals( javaHome ) ) {
iCmdPrefix = javaHome + File.separator + "bin" + File.separator + JavaUtil.COMPILER_javac;
return execute();
}
else {
return false;
}
}
else {
return false;
}
}
}
) );
*/
if( !successful ) {
boolean containsErrorMsgs = -1 < cmd.getOutResult().indexOf("error");
System.out.println("cem:"+containsErrorMsgs);
if( cmd.hasErrResult() || containsErrorMsgs ) {
throw ProcessException.CODE_compile_errors( cmd.getExecutedCmd() + Standard.NEWLINE
+ cmd.getOutResult() + Standard.NEWLINE
+ cmd.getErrResult() + Standard.NEWLINE
);
}
else if( cmd.wasNotFound() ) {
throw ProcessException.CODE_compiler_not_found( compiler );
}
else {
throw ProcessException.CODE_compile_failed( cmd.getExecutedCmd() + Standard.NEWLINE
+ cmd.getOutResult() + Standard.NEWLINE
+ cmd.getErrResult() + Standard.NEWLINE
);
}
}
}
}