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 37733] New: - ANT from a java program: How catch exception?
Date Thu, 01 Dec 2005 09:45:45 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37733>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37733

           Summary: ANT from a java program: How catch exception?
           Product: Ant
           Version: 1.6.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: tlame@infovista.com


I want call ANT from my java code.

To do this, the ANT class org.apache.tools.ant.launch.Launcher is available.
The only public access of this class is the main method (Launcher.main(String[] 
args)).

If the launcher generates an exception how can I catch it from my java code?
The first idea is to code the "main" method content in my java class

   try {
      Launcher mylauncher= new Launcher();
      mylauncher.run(args); //args : my array of arguments
   } catch (LaunchException e) { 
      // ... do something 
   }

This code is not possible because the "run" method is private. (private void run
(String[] args) throws LaunchException, MalformedURLException {)

The second idea is to rewrite the entire class 
org.apache.tools.ant.launch.Launcher but this solution is not correct.

Have-you any solution to solve this problem?

Regards.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message