File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 73

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: 18135

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.)
I agree. Here's the link:
subject: Starting/Stopping Tomcat windows service through Java
Similar Threads
Starting Apache Tomcat Server 6
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
Problem with tomcat6X Stratup on windows vista
How to config tomcat 5.5 in debug ?