Tomcat provides some useful startup/shutdown scripts located at its installation folder, so you can call those scripts from a Java program using the Runtime.exec() command.

Spring 3