Apache Tomcat (or simply Tomcat) is an open source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (
JSP) specifications from Oracle Corporation, and provides a “pure Java”
HTTP web server environment for Java code to run.
tomcat as Windows Service. Running Tomcat as a Windows Service provides a number of benefits that are essential when moving from a development set-up to a production environment.
Reliable automatic startup on boot
- Essential in an environment where you may want to remotely reboot a Java System after maintenance without worrying about whether your server will come back online.
Server startup without active user login
- In a data center, it is not reasonable to expect an active login from the system just to run Tomcat. In fact, Tomcat is often run on blade servers that may not even have an active monitor connected to them. Windows Services are owned by the System, and can be started without an active user.
start/stopmy Tomcat Server via command line as wanted to create quick shall script to do it. This official documentation provided below commands in the form of
The available command line options are:
//TS//Run the service as console application This is the default operation. It is called if the no option is provided. The ServiceName is the name of the executable without exe suffix, meaning Tomcat6
//RS//Run the service Called only from ServiceManager
//SS//Stop the service
//US//Update service parameters
//DS//Delete service Stops the service if running
But rather doing it this way I found below commands very useful and simple.
Other must read articles:
- How to Get Tomcat Directory Path in Java
- How to Increase Tomcat HeapSize (JVM Heap) in Eclipse (EDE)
1) Windows (if Tomcat is setup as Windows Service)
- To Start server: <Tomcat Root>/bin>Tomcat7.exe start
- To Stop server: <Tomcat Root>/bin>Tomcat7.exe stop
2) Windows (if you have downloaded binaries as .zip)
- To Start server: <Tomcat Root>/bin>startup.bat
- To Stop server: <Tomcat Root>/bin>shutdown.bat
3) Mac/Linux/Unix (if you have downloaded binaries as .zip)
- To Start server: <Tomcat Root>/bin>startup.sh
- To Stop server: <Tomcat Root>/bin>shutdown.sh