org.apache.tools.ant.launch.Launcher.main() is the recommended way to launch ant from Java as per https://ant.apache.org/manual/running.html#viajava . However, org.apache.tools.ant.launch.Launcher.main() calls System.exit(exitCode); (l.114) This means that integrating this launcher will kill a VM on an error. This issue cannot be addressed by subclassing as the constructor of Launcher is private, not protected, and is called from main(). This means that any reuser either needs to spawn a VM, or copy the class into a private namespace, shadow it or copy the dispatch method under a different name to extend. None of these alternatives is appealing. Please ensure that this reuse issue is fixed or deprecate the launcher if it is not intended for this purpose or cannot be used this way.