ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 21410] New: - javah task doesn't work w/ j2sdk1.4.2
Date Tue, 08 Jul 2003 15:31:46 GMT
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: dev@ant.apache.org
        ReportedBy: apache@keithley.org


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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message