简体   繁体   English

每当我在java文件中编辑时,我都必须重新启动apache服务器以将这些更改应用到类文件中

[英]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. 每当我在java文件中进行任何更改时,我都必须一次又一次重新启动服务器,以进行很小的更改。 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. 我尝试在保存时自动发布,但仍然无法正常工作。

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 (ie $TOMCAT/webapps/YOUR_WEB_APPLICATION/WEB_INF/classes). 我认为最简单的方法是让日食将类文件直接写入tomcat webapp类文件夹(即$ 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. 然后,允许tomcat检查类文件是否已更新,如果有,请重新加载它们。

  • To allow tomcat auto-reload class when classes are changes, please update 要在更改类时允许tomcat自动重新加载类,请更新

$TOMCAT_HOME/conf/context.xml

<Context reloadable="true"> 
  • There is on more thing you need to update in your web application to allow reload. 您还需要在Web应用程序中进行更新以允许重新加载。 in your application web.xml file and add <web-app reloadable="true" >. 在您的应用程序web.xml文件中,并添加<web-app reloadable="true" >。

Ideally for changes to get reflected you will have to restart the server. 理想情况下,为了反映更改,您将必须重新启动服务器。 The only way to get it done is to replace the specific class file by compiling the class, and manually replacing the class inside the war (assuming you have a Tomcat). 完成此任务的唯一方法是通过编译类来替换特定的类文件,并在战争中手动替换该类(假设您有Tomcat)。

In usual cases the above process will take almost the same time as deploying a new war/ear and having the server restarted. 在通常情况下,上述过程几乎与部署新的war / ear并重新启动服务器所需的时间相同。

PS: I would not personally recommend the above solution, since it's a hack and you may run into multiple problems when you do an actual build. PS:我个人不会推荐上述解决方案,因为这是一个hack,在进行实际构建时可能会遇到多个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么每次更改/编辑 java servlet 代码时都需要重新启动 Tomcat Apache 服务器 - Why I need to restart Tomcat Apache server every time I change/edit my java servlet code 为什么每次重新启动程序时都会删除此data.txt文件? - Why is this data.txt file deleted whenever I restart the program? Java“无法加载Main-Class清单属性”在任何.jar文件上,即使我之前成功打开过的文件也是如此 - Java “Failed to load Main-Class manifest attribute” On a any .jar file, even those that I have succeed in opening before 编辑jar文件后无更改 - No changes after I edit a jar file 错误:找不到或加载主类-每当我创建新的Java文件时 - Error: Could not find or load main class - Whenever I make a new Java file Google App Engine-每当我更改servlet时,都必须重新启动开发服务器 - Google App Engine - I have to restart the development server anytime I make changes to a servlet 我有一个外部可执行jar文件,希望使用Eclipse编辑其中的Java文件。 - I have an external executable jar file that I wish to edit the java files in it with Eclipse 在Java中,文件中可以有多个类/对象吗? - In java can i have more than one class/object in a file? 尽管我有 jar 文件,但在 java 中找不到类异常 - Class not found exception in java though I have the jar file antlr:我可以让生成的java文件扩展现有的类 - antlr: can I have the generated java file extends an existing class
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM