Understanding Tomcat Restarting - When and When Not

Tomcat, The funny cat that Play with us :)


Tomcat, the most famous application server used till date. The only frustration with it is restarting when you modify the code. Oh no! really disgusting, but i like that cat and dont want to leave it. Fine, let us understand when and when not to restart tomcat.





Modifying HTML Files


You need not. Modifying HTML files doesn't need restarting tomcat. Because they are not loaded in the tomcat and will dynamically be called when the user requests.

Modifying web.xml


No again. web.xml is used by Tomcat, to pass the user's request to specified class. It is dynamically called and is not pre-loaded in Tomcat. So you don't have to.

Modifying JSP Files


No. They are also dynamically called. JSP files contain pre-defined objects, if they are modified, the code written in them, the scriptlets (java code) will automatically be compiled dynamically, so you need not worry about it.

Modifying Servlets and other Classes


Yes. You have to restart tomcat. Because, when Tomcat starts, the .class files are loaded, when you modify the class, you compile it and .class file is changed. So, to reload those modified .class files, you will have to restart tomcat.

Better way of Restarting Tomcat


When writing Servlet classes, you work with Command Prompt, so it could be better if you start tomcat with commands

net stop Tomcat7
net start Tomcat7
I'm working with Tomcat 7, if you have another version, then check the name of the service,


  1. Go to services.msc from RUN (Start+R)
  2. Look, Apache Tomcat service, double-click it, and then a dialog opens, displaying Service Name and that is what i used here. For me it is, Tomcat7