做過Java WEB開發的都知道在對類文件的方法名進行修改時,要重新重啓Web服務器類的修改才生效。而在開發中要等Web服務器重啓也要一定的時間,利用javaRebel(jRebel)可以做到修改類文件後即時加載(其實更準確的說應該是當應用訪問到該類時才加載),不用再去重新啓動Web服務器,提高了開發效率。
javaRebel(jRebel)的安裝配置:
javaRebel(jRebel)有兩種安裝方式,一種是eclipse的插件方式,另一種是直接設置tomcat的jvm參數的方式。
第二種方法的安裝比較簡單,現以第二種來安裝配置。具體的方法就是(此處以tomcat6爲例):window-preferences-servers-tomcat-tomcat 6.x-jdk-Optional java vm arguments這個框裏面輸入java vm的參數,具體設置如下:
Java代碼
- -noverify
- -javaagent:F:/jrebel-3.0-M1/jrebel.jar
- -Drebel.dirs=F:\MyEclipse7.0M1\eclipse\workspace\qhtjProject_new\WebRoot\WEB-INF\classes
個別參數說明:
-javaagent: 這個是你使用的javaRebel(jRebel)的jar包的路徑,注意其中的斜線方向。
-Drebel.dirs= 這個是你要監控的項目的class文件路徑(經過驗證該參數可以不用設置,javaRebel會自動去監測class文件的修改情況)
設置完成後,確定,返回。下來把tomcat的<Context reloadable="false" ............ /> reloadable="false"這裏要設置成false纔可以。至此,就算配置完成了,啓動tomcat就會在控制檯看到有關javaRebel(jRebel)的輸入信息:
Java代碼
- Mon Oct 26 17:46:15 CST 2009 com.zeroturnaround.javarebel.hD#new V( false )
- Mon Oct 26 17:46:15 CST 2009 com.zeroturnaround.javarebel.bH#public boolean a(byte abyte0[])
- #############################################################
- JRebel 3.0-M1 (200910151623)
- (c) Copyright ZeroTurnaround, Ltd, 2007-2009. All rights reserved.
- A rough estimate: Over the last 1 days JRebel
- prevented the need for at least 0 redeploys/restarts.
- Using industry standard build and redeploy times,
- JRebel saved you between 0 and 0 hours.
- This product is licensed to Java Hack Organization
- for unlimited number of developer seats on site.
- #############################################################
Mon Oct 26 17:46:15 CST 2009 com.zeroturnaround.javarebel.hD#new V( false )
Mon Oct 26 17:46:15 CST 2009 com.zeroturnaround.javarebel.bH#public boolean a(byte abyte0[])
#############################################################
JRebel 3.0-M1 (200910151623)
(c) Copyright ZeroTurnaround, Ltd, 2007-2009. All rights reserved.
A rough estimate: Over the last 1 days JRebel
prevented the need for at least 0 redeploys/restarts.
Using industry standard build and redeploy times,
JRebel saved you between 0 and 0 hours.
This product is licensed to Java Hack Organization
for unlimited number of developer seats on site.
#############################################################
OK,到此就說明配置成功了,接下來,可以試試修改了java類文件後,還有沒有容器自動加載的漫長過程了!!趕快去試一下吧!!!!