简体   繁体   中英

Identifying Tomcat start up Programmatically

I am developing a automation tool where I have to manage tomcat through java. I can start and stop the tomcat using

Runtime.getRuntime().exec("c:/program files/tomcat/bin/startup.bat"); and

Runtime.getRuntime().exec("c:/program files/tomcat/bin/shutdown.bat");

and I can deploy the war files by copying to the web apps folder on startup of tomcat.

The Issue is how to identify the tomcat is started programmatically .so that once it is started I can copy files into it.

You can use an Embedded Tomcat in your application. Have a look at this tutorial:

https://devcenter.heroku.com/articles/create-a-java-web-application-using-embedded-tomcat

The main entry point for Embedded Tomcat is this class:

http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/startup/Embedded.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM