How to manage Tomcat via Java

前端 未结 6 1629
温柔的废话
温柔的废话 2020-12-21 22:48

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.

6条回答
  •  暖寄归人
    2020-12-21 23:13

    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/

提交回复
热议问题