DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21410>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21410 javah task doesn't work w/ j2sdk1.4.2 Summary: javah task doesn't work w/ j2sdk1.4.2 Product: Ant Version: 1.5.3 Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Optional Tasks AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] 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; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]