Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News JavaRebel: Dynamic Classloading in the JVM

JavaRebel: Dynamic Classloading in the JVM

This item in japanese

JavaRebel brings Ruby and PHP style dynamic reloading of classes to Java. While it currently has several limitations it can speed up development dramatically.

JavaRebel allows an application (stand-alone or within an application server) to reload most class changes on the fly, including adding and removing methods and fields.

Using bytecode modification and a little bit of magic JavaRebel extends the JVM with ability to reload almost arbitrary changes to classes on-the-fly. This includes adding and removing both methods and fields and the only forbidden changes are to ‘extends’ and ‘implements’ clauses. Since all the existing object instances are preserved the application and server can continue running and code changes are immediately visible in the application.

Some limitations that have been discovered include:

  • getClass().getPackage() returns null. Zeroturnaround is aware of this and are working on resolving it
  • Customer classloaders are not supported
  • No hooks are currently provided for performing actions at resource reload (for instance refreshing an object in a dependency graph in a Spring application)

Despite the current limitations, feedback has been generally positive. Likewise, Zeroturnaround is working to make nightly builds available for use and plans to release an SDK soon to help solve some problems, such as the custom classloader restriction.

Rate this Article