• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

JVM terminates when callling ant script from java

 
Ranch Hand
Posts: 111
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to run ant script from java code like this:
Launcher.main(new String[]{"-f","C:\\Projects\\ant_projects\\chap1\\Echo2.xml"});
System.out.println("*********** In End");

and able to successfully call the ant script but it looks that JVM is terminated after calling ant script as the logger "in End" is not printed in the console.

Is there any way to change this default behariour of ant to exit the JVM?

Please help.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looking at the source code, Launcher.main calls System.exit if there is a non-zero exit code. You could try calling the run method instead, like this:

int code = new Launcher().run(new String[]{...});
 
reply
    Bookmark Topic Watch Topic
  • New Topic