FileDocCategorySizeDatePackage
KaffeRmic.javaAPI DocApache Ant 1.703623Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.taskdefs.rmic

KaffeRmic

public class KaffeRmic extends DefaultRmicAdapter
The implementation of the rmic for Kaffe
since
Ant 1.4

Fields Summary
private static final String[]
RMIC_CLASSNAMES
public static final String
COMPILER_NAME
the name of this adapter for users to select
Constructors Summary
Methods Summary
public booleanexecute()
{@inheritDoc}


      
         
        getRmic().log("Using Kaffe rmic", Project.MSG_VERBOSE);
        Commandline cmd = setupRmicCommand();

        Class c = getRmicClass();
        if (c == null) {
            StringBuffer buf = new StringBuffer("Cannot use Kaffe rmic, as it"
                                                + " is not available.  None"
                                                + " of ");
            for (int i = 0; i < RMIC_CLASSNAMES.length; i++) {
                if (i != 0) {
                    buf.append(", ");
                }

                buf.append(RMIC_CLASSNAMES[i]);
            }
            buf.append(" have been found. A common solution is to set the"
                       + " environment variable JAVA_HOME or CLASSPATH.");
            throw new BuildException(buf.toString(),
                                     getRmic().getLocation());
        }

        cmd.setExecutable(c.getName());
        if (!c.getName().equals(RMIC_CLASSNAMES[RMIC_CLASSNAMES.length - 1])) {
            // only supported since Kaffe 1.1.2
            cmd.createArgument().setValue("-verbose");
            getRmic().log(Commandline.describeCommand(cmd));
        }
        ExecuteJava ej = new ExecuteJava();
        ej.setJavaCommand(cmd);
        return ej.fork(getRmic()) == 0;
    
private static java.lang.ClassgetRmicClass()
tries to load Kaffe RMIC and falls back to the older class name if necessary.

return
null if neither class can get loaded.

        for (int i = 0; i < RMIC_CLASSNAMES.length; i++) {
            try {
                return Class.forName(RMIC_CLASSNAMES[i]);
            } catch (ClassNotFoundException cnfe) {
                // Ignore
            }
        }
        return null;
    
public static booleanisAvailable()
test for kaffe being on the system

return
true if kaffe is on the current classpath

        return getRmicClass() != null;