permaculture playing cards*
The moose likes Tomcat and the fly likes Starting/Stopping Tomcat windows service through Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Starting/Stopping Tomcat windows service through Java" Watch "Starting/Stopping Tomcat windows service through Java" New topic

Starting/Stopping Tomcat windows service through Java

John Farrel
Ranch Hand

Joined: May 24, 2010
Posts: 83

I am writing a system to deploy tomcat wars across multiple tomcat installations.
I have been undeploying with tomcat manager, copying the war and deploying with tomcat manager.

However, due to flakiness with tomcat, or the manager, I would also like to restart the tomcat windows service.

Is there some magic in tomcat manager to shutdown tomcat? Then the windows service would restart it.
Otherwise, are there any libraries for accessing a remote windows machine and start/stop services?

Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

Seems to me that the easiest method would be to use System.getRuntime().exec() to execute the Windows command to start and stop services. (Which I don't remember what they are, but I do remember that they exist.)
subject: Starting/Stopping Tomcat windows service through Java
Similar Threads
Tomcat 6.0.32 HTTP Status 403 - Access to the requested resource has been denied
WAS 6.1 on Windows - How to restart an Application Server via Windows Services
How to config tomcat 5.5 in debug ?
Problem with tomcat6X Stratup on windows vista
Starting Apache Tomcat Server 6