You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2005/12/01 10:45:45 UTC

DO NOT REPLY [Bug 37733] New: - ANT from a java program: How catch exception?

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