JRebel是一款JAVA虛擬機插件,它使得JAVA程序員能在不進行重部署的情況下,即時看到代碼的改變對一個應用程序帶來的影響。
這樣再也不用修改java文件之後頻繁的去重啓Web Server了,用起來非常的順手。本版本jrebel5,已破解,放心使用。在官網下載試用的期限爲30天,地址:http://zeroturnaround.com/software/jrebel/download/#!/
將下載的jrebel.jar放到隨便一個路徑,例如E:\jrebel.jar
Myeclipse中window-preferences-Myeclipse-servers-tomcat-tomcat 6.x-jdk-Optional java vm arguments這個框裏面輸入java vm的參數
-noverify
-javaagent:E:\jrebel.jar
-Drebel.dirs=E:\Workspaces\jghq\WebRoot\WEB-INF\classes
-Drebel.spring_plugin=true
-Drebel.struts2-plugin=true
說明:
-javaagent就是你存放JRebel的路徑
-Drebel.dirs 指定要監控的 編譯後的java 文件目錄,這個目錄和上邊javarebel.jar的路徑千萬不要有空格和中文,最好連.也不要有。
-Drebel.spring_plugin 表示對Spring的支持,默認是false
-Drebel.struts2-plugin=true,這裏是-而不是_,千萬不要自作聰明
配置完上面後,還需要關閉tomcat的應用程序的reloadable設置
接下來,可以啓動Tomcat服務了,如果配置正確,啓動服務後,會有以下提示
[2013-03-05 18:07:03]
[2013-03-05 18:07:03] #############################################################
[2013-03-05 18:07:03]
[2013-03-05 18:07:03] JRebel 5.0.0 (201206080930)
[2013-03-05 18:07:03] (c) Copyright ZeroTurnaround OU, Estonia, Tartu.
[2013-03-05 18:07:03]
[2013-03-05 18:07:03] Over the last 1 days JRebel prevented
[2013-03-05 18:07:03] at least 0 redeploys/restarts saving you about 0 hours.
[2013-03-05 18:07:03]
[2013-03-05 18:07:03] This product is licensed to Unlimited
[2013-03-05 18:07:03] For FUN! Unlimited! Enjoy!
[2013-03-05 18:07:03]
[2013-03-05 18:07:03] The following plugins are disabled at the moment:
[2013-03-05 18:07:03] * Apache MyFaces plugin (set -Drebel.myfaces_plugin=true to enable)
[2013-03-05 18:07:03] * Click plugin (set -Drebel.click_plugin=true to enable)
[2013-03-05 18:07:03] * JRuby Plugin (set -Drebel.jruby_plugin=true to enable)
[2013-03-05 18:07:03] * Jersey plugin (set -Drebel.jersey_plugin=true to enable)
[2013-03-05 18:07:03] * Oracle ADF Core plugin (set -Drebel.adf_core_plugin=true to enable)
[2013-03-05 18:07:03] * Oracle ADF Faces plugin (set -Drebel.adf_faces_plugin=true to enable)
[2013-03-05 18:07:03] * Seam-Wicket plugin (set -Drebel.seam_wicket_plugin=true to enable)
[2013-03-05 18:07:03] * WebObjects plugin (set -Drebel.webobjects_plugin=true to enable)
[2013-03-05 18:07:03]
[2013-03-05 18:07:03] #############################################################
[2013-03-05 18:07:03]
[2013-03-05 18:07:03]
[2013-03-05 18:07:03] JRebel: Directory 'E:\Workspaces\jghq\WebRoot\WEB-INF\classes' will be monitored for class changes.
[2013-03-05 18:07:03]
如果出上以上提示,則表示JavaRebel已經配置成功。
接下來大家可以在MyEclipse中修改代碼,進行編譯進行測試。
如果MyEclipse提示, 則直接關接不理它即可,你發現你修改後的 class文件已經被jvm加載了。