Search code examples
javaeclipseapache.class-file

Whenever i edit in java file , i have to restart apache server for apply those changes in class file


Whenever I make any changes in java file, I have to restart server again and again for even small changes it. changes do not publish to server.

It is really time taken process. how can I apply those changes in server without restarting server ?

I tried to auto publish while saving, but still it does not work.


Solution

  • I think the most simple way to do this is to let your eclipse write the class files directly to the tomcat webapp class folder (i.e. $TOMCAT/webapps/YOUR_WEB_APPLICATION/WEB_INF/classes). Then, allow tomcat to check if the class files have been updated, and reload them if they have.

    • To allow tomcat auto-reload class when classes are changes, please update

    $TOMCAT_HOME/conf/context.xml

    <Context reloadable="true"> 
    
    • There is on more thing you need to update in your web application to allow reload. in your application web.xml file and add <web-app reloadable="true">.