The following patch is necessary to use ant with j2sdk1.4.2 This patch just punts the problem by using the "oldjavah" package instead of the NewAndImproved javah package. The dearth of documentation for the javah package makes it difficult to know what the correct fix might actually be. *** apache-ant-1.5.3-1/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java.orig Mon Jul 7 15:51:51 2003 --- apache-ant-1.5.3-1/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java Mon Jul 7 16:26:01 2003 *************** *** 347,355 **** // dynamically. However, javah has a different interface and this // makes it harder, so here's a simple alternative. //------------------------------------------------------------------ ! com.sun.tools.javah.Main main ! = new com.sun.tools.javah.Main(cmd.getArguments()); ! main.run(); } catch (Exception ex) { if (ex instanceof BuildException) { throw (BuildException) ex; --- 347,374 ---- // dynamically. However, javah has a different interface and this // makes it harder, so here's a simple alternative. //------------------------------------------------------------------ ! Class parameterTypes[] = new Class[1]; ! parameterTypes[0] = new String[0].getClass(); ! Class javahMain = Class.forName("com.sun.tools.javah.Main"); ! java.lang.reflect.Constructor ctor = null; ! try { ! ctor = javahMain.getConstructor(parameterTypes); ! } catch (NoSuchMethodException nsme) { ! javahMain = Class.forName("com.sun.tools.javah.oldjavah.Main"); ! ctor = javahMain.getConstructor(parameterTypes); ! } ! ! Object args[] = new Object[1]; ! args[0] = cmd.getArguments(); ! ! // com.sun.tools.javah.Main main ! // = new com.sun.tools.javah.Main(cmd.getArguments()); ! Object main = ctor.newInstance(args); ! ! // main.run(); ! java.lang.reflect.Method run = javahMain.getMethod("run", new Class[0]); ! run.invoke(main, new Object[0]); ! } catch (Exception ex) { if (ex instanceof BuildException) { throw (BuildException) ex;
*** This bug has been marked as a duplicate of 18667 ***