This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JVM terminates when callling ant script from java

 
Abdul Mohsin
Ranch Hand
Posts: 111
Java Linux Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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[]{...});
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic