Wednesday, July 25, 2012

Better Java Hot Swapping with DCE VM


I recently discovered a great tool called "Dynamic Code Evolution VM" that was written by Thomas W├╝rthinger and others.  It allows for complete hot swapping of code in Java.

Normally when debugging a Java application you can update some portions of the running code without having to restart the application.  However, with the standard Sun/Oracle JVM this is limited to changes inside a method body.  Did you just add or delete a field or method?  Sorry, but you must restart the application to see the changes.  Or did you change the inheritance hierarchy of a class?  Again, no luck if you 're using the standard JVM.

However, if you use DCE VM, the new code in all these cases is swapped in and you can continue on without any restarts needed.  This is invaluable when developing and debugging a web application...restarts take a lot of time and over the course of a year it probably adds up to days or even weeks of time saved!

Word on the street has it that Thomas and his team are now working for Oracle, and DCE VM will eventually make its way into the standard JVM in version 1.8.  However, there's no need to wait.  Download DCE VM from http://java.net/projects/dcevm to get started with a better hot swap today.