When developing Servlet using Tomcat and Eclipse, I find that I have to restart Tomcat once I change the code for my Servlet, or I will see nothing that have been changed.
Why I have to do that?
and
Is there a way to see the change without restart Tomcat?
You can configure tomcat for reload automatically your servlets, configure the atribute reloadable to true of the Context.
For do Tomcat 7 you must do.
<Context>
For:
<Context reloadable="true">
Where CATALINA_HOME is your tomcat installation
The java classes you're editing are compiled into class files, which are loaded by the Tomcat class loader when Tomcat starts up your app. But the class loader doesn't try to load new versions of the class after Tomcat starts up your application.
Eclipse does have a neat feature called "hot code replace" but it only works while you're debugging your application. In this case, Eclipse compiles your code as you're editing (whether or not your debugging), and then Eclipse attempts to load in the newly edited classes that it compiled. But it only works while debugging your app.
Another option is try a JVM plugin like JRebel that hot-swaps your classes regardless of whether or not your debugging.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With