i\'m looking for a way to manage tomcat (on localhost) programmatically via java. I want to start/stop tomcat and deploy WARs.
Any help is appreciated.
The way to start/stop tomcat through java is to call execute on the bootstrap.jar (Use the class Runtime) with the sample parameters: -Dcatalina.home=c:/tomcat/
Sample code to see how ant executes tomcat start stop:
http://ptrthomas.wordpress.com/2006/03/25/how-to-start-and-stop-tomcat-from-ant
Sample code to see how external programs are executed from java: http://www.linglom.com/2007/06/06/how-to-run-command-line-or-execute-external-application-from-java/