Wednesday, April 15, 2009

JavaRebel - JVM HotSwap plugin

I recently encountered this and find it very useful in my UI development. I use the eclipse debugger not only for debugging but also to make changes to my code without restarting my application. But, the debugger uses JVM HotSwap and is very limited since it only allows to make changes to my method i.e I can add/change contents of the method, but if I remove a method, remove a constructor etc., then it fails to reload properly. JavaRebel comes out great in these areas. It is basically a JVM plugin (javaagent) which enables you to see changes to the code immediately without restarting the application.

Using JavaRebel

They offer a free trial (which is what I'm using now). Go here to download the zip file. Just unzip the file and add the following vm arguments to your application.

-noverify -javaagent:your/path/to/javarebel.jar

It is basically an advanced version of JVM HotSwap plugin. You can see the comparison matrix here in their web-site.

When you start the application, it prints info about JavaRebel and also whenever you make changes to the code, it also prints which classes are loaded dynamically. Right now, I'm using this for eclipse plugin development, but this can be used for other purposes like creating a web-application etc.,

No comments: