Hi, Ant!! At Wed, 07 Mar 2001 12:21:40 +0900, Takashi Okamoto wrote: > I post a patch for Kaffe problem at ZipOutputStream. One more thing for Kaffe. Following line depend on SUN' JDK (tools.jar): src/main/org/apache/tools/ant/taskdefs/ at line 252: sun.rmi.rmic.Main compiler = new sun.rmi.rmic.Main(logstr, "rmic"); We can't compile and use Ant by Jikes and Kaffe. I suggest using reflection API to use both sun and kaffe rmic. Please refer following patch and fix it (but I didn't test it). regards. --------------- Takashi Okamoto ------------------------------------------------------------- --- src/main/org/apache/tools/ant/taskdefs/Rmic.java.orig Thu Mar 8 09:26:48 2001 +++ src/main/org/apache/tools/ant/taskdefs/Rmic.java Thu Mar 8 09:29:05 2001 @@ -63,6 +63,8 @@ import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.util.*; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; import java.io.*; import java.util.StringTokenizer; import java.util.Vector; @@ -249,7 +251,6 @@ // need to provide an input stream that we read in from! OutputStream logstr = new LogOutputStream(this, Project.MSG_WARN); - sun.rmi.rmic.Main compiler = new sun.rmi.rmic.Main(logstr, "rmic"); Commandline cmd = new Commandline(); cmd.createArgument().setValue("-d"); @@ -292,7 +293,33 @@ cmd.createArgument().setValue((String) compileList.elementAt(j)); } log("Compilation args: " + cmd.toString(), Project.MSG_VERBOSE); - compiler.compile(cmd.getArguments()); + + Object compiler = null; + Method compile = null; + Class c = null; + Constructor cons = null; + try { + // SUN's rmic + c = Class.forName("sun.rmi.rmic.Main"); + cons = c.getConstructor(new Class[] + { OutputStream.class, String.class }); + compiler = cons.newInstance(new Object[] { logstr, "rmic" }); + compile = c.getMethod("compile", new Class [] + { String[].class }); + compile.invoke(compiler, (Object[]) cmd.getArguments() ); + } catch (Exception es) { + try { + // Kaffe's rmic + c = Class.forName("kaffe.rmi.rmic.RMIC"); + cons = c.getConstructor(new Class[] { String[].class }); + compiler = cons.newInstance(new Object[] { cmd.getArguments() }); + compile = c.getMethod("run", null); + compile.invoke(compiler, null); + } catch (Exception ek) { + ek.printStackTrace(); + System.exit(1); + } + } } // Move the generated source file to the base directory