Monthly Archives: April 2006

Hotswapping code in Java

A nice feature present in the latest JVM versions is the ability to hotswap a class: that is, to modify a class from a running application without having to restart it. This obviously helps to speed up the development process.

Eclipse takes advantage of this feature (it’s called Hot code replacement), and its users claim that it’s one of the best reasons to use this IDE. However, as it’s really a feature of the JVM, you can use it too without needing to use Eclipse at all. For example, Netbeans has it too, and it’s named Apply code changes.

But what happens if you don’t use an IDE with this feature? No problem. David Kavanagh has written a Hotswap task for Ant, so you can replace your running code from the command line and benefit from this feature from within Emacs or whatever editor you like.

Good hotswapping!