JavaRebel impressions – Java Reload just like in Rails
JavaRebel promises Ruby on Rails and PHP reloadability for Java. It is a library that works as an agent to the Java Virtual machine and helps the VM dynamically reload Java classes when they have changed. The setup I used was a fairly large application with dozends of modules, tomcat 6 and Eclipse as my IDE. When installing JavaRebel be sure to change both paths to the JAR in your JAVA_OPTS. I only changed one and the VM couldn’t load the JAR. With some friendly and speedy help from the JavaRebel developers the problem was found in only a few minutes.
There isn’t much of a review here. JavaRebel works as advertised. Adding code, extracting methods and changing your class, then save it with auto compile in Eclipse and press reload in your browser. The file is changed. Just as with PHP or Rails. Great news. With some large tomcat setups that need several minutes for startup, this saves a lot of time (and essentially money). Why not use the Hotswap function with Eclipse? HotSwap with the VM currently only supports changing code in methods. JavaRebel supports refactoring like adding and removing methods, fields or constructors. With HotSwap you also need to attach a debugger and switch to the debugger view. One click too much.
I asked them for a open source license some days ago and now they provide one. Thanks.
As a first impression: Excellent tool. We’ll see how it does in a real development situation for some days. I’ll keep you informed.
You can leave a Reply here. Of course, you should follow me on twitter here.
So the reason why you often need to restart and see the results on the screen is because you do manual testing on the screen rather than automated tests? When I develop j2ee apps I rarely need to do slow restarts of the application server as I test my components outside the webapp! When I develop my Super CSV reader/writer (http://supercsv.sourceforge.net/), I do not check the files it produces, I let Junit do all the tedious and repetitive work for me.
Finally, what happens if you are doing a change across several classes? how do you ensure that you do not refresh a class that does not fully work, as it rely on methods in other classes working in a different manner than they presently do (you haven’t yet edited those files).
Hope to hear your input..