本文以javarebel-2.0 free版本為例,包括如何配置在使用Eclipse插件開發(fā)tomcat應(yīng)用時,實現(xiàn)即時重載java class更改。
1. 首先下載JavaRebel, 官方下載(Free版本) , 下載后解壓到本地目錄,例如 D:/javarebel.jar
2. 因為JavaRebel在不同的jdk版本,配置也不同,本例以JDK5+以上版本為例
在Eclipse的tomcat插件中,配置 JavaReble
在Jvm配置中加入下面的設(shè)置
-noverify
-javaagent:D:/javarebel.jar
-Drebel.dirs=D:projectWEB-INFclasses
-Drebel.spring_plugin=true
說明:
-Drebel.dirs 指定要監(jiān)控的 編譯后的java 文件目錄
-Drebel.spring_plugin 表示對Spring的支持,默認(rèn)是false
配置完上面后,還需要關(guān)閉tomcat的應(yīng)用程序的reloadable設(shè)置
接下來,可以啟動Tomcat服務(wù)了,如果配置正確,啟動服務(wù)后,會有以下提示
##########################################
ZeroTurnaround JavaRebel 2.0 (200903241906)
(c) Copyright Webmedia, Ltd, 2007-2009. All rights reserved.
You are running JavaRebel evaluation license.
You have 30 days until the license expires.
You will see this notification until you obtain a
full license for your installation.
Visit www.javarebel.com for instructions on obtaining
a full license. If you wish to continue your evaluation
please e-mail to support@zeroturnaround.com.
If you think you should not see this message contact
support@zeroturnaround.com or check that you have your
license file in the same directory as the JAR file.
###########################################
JavaRebel: Directory ’D:developWEB-INFclasses’ will be monitored for class changes.
============= [JavaRebel Spring Framework Plugin] =============
Plugins are contributed by third party and can cause compatibility problems.
If you have any troubles set -Drebel.spring_plugin=false to disable it.
--------------
Description: Supports adding new beans and adding new bean dependencies using
annotations or XML. Singletons will be reconfigured after the change. It also
supports adding or changing Spring MVC controllers or handlers.
============= [/JavaRebel Spring Framework Plugin] ============
如果出上以上提示,則表示JavaRebel已經(jīng)配置成功。
接下來大家可以在Eclipse中修改代碼,進(jìn)行編譯進(jìn)行測試。
如果Eclipse提示, 則直接關(guān)接不理它即可,你發(fā)現(xiàn)你修改后的 class文件已經(jīng)被jvm加載了。
1. 首先下載JavaRebel, 官方下載(Free版本) , 下載后解壓到本地目錄,例如 D:/javarebel.jar
2. 因為JavaRebel在不同的jdk版本,配置也不同,本例以JDK5+以上版本為例
在Eclipse的tomcat插件中,配置 JavaReble
在Jvm配置中加入下面的設(shè)置
-noverify
-javaagent:D:/javarebel.jar
-Drebel.dirs=D:projectWEB-INFclasses
-Drebel.spring_plugin=true
說明:
-Drebel.dirs 指定要監(jiān)控的 編譯后的java 文件目錄
-Drebel.spring_plugin 表示對Spring的支持,默認(rèn)是false
配置完上面后,還需要關(guān)閉tomcat的應(yīng)用程序的reloadable設(shè)置
接下來,可以啟動Tomcat服務(wù)了,如果配置正確,啟動服務(wù)后,會有以下提示
##########################################
ZeroTurnaround JavaRebel 2.0 (200903241906)
(c) Copyright Webmedia, Ltd, 2007-2009. All rights reserved.
You are running JavaRebel evaluation license.
You have 30 days until the license expires.
You will see this notification until you obtain a
full license for your installation.
Visit www.javarebel.com for instructions on obtaining
a full license. If you wish to continue your evaluation
please e-mail to support@zeroturnaround.com.
If you think you should not see this message contact
support@zeroturnaround.com or check that you have your
license file in the same directory as the JAR file.
###########################################
JavaRebel: Directory ’D:developWEB-INFclasses’ will be monitored for class changes.
============= [JavaRebel Spring Framework Plugin] =============
Plugins are contributed by third party and can cause compatibility problems.
If you have any troubles set -Drebel.spring_plugin=false to disable it.
--------------
Description: Supports adding new beans and adding new bean dependencies using
annotations or XML. Singletons will be reconfigured after the change. It also
supports adding or changing Spring MVC controllers or handlers.
============= [/JavaRebel Spring Framework Plugin] ============
如果出上以上提示,則表示JavaRebel已經(jīng)配置成功。
接下來大家可以在Eclipse中修改代碼,進(jìn)行編譯進(jìn)行測試。
如果Eclipse提示, 則直接關(guān)接不理它即可,你發(fā)現(xiàn)你修改后的 class文件已經(jīng)被jvm加載了。

