Magnolia CMS - Freelance Developer
Magnolia CMS - Freelance Developer

Hotswapping Java code

Hotswapping Java code is a technique that can save a lot of down time for programmers when you’re working with web applications that take forever to start up. By recompiling and reloading the changed classes it allows you to see the effect of code changes while the application remains up and running.

The Java Virtual Machine supports hotswapping out of the box, but in a very rudimentary way. The capabilities of your standard JVM are limited to being able to hotswap the code for a method body. If you add, remove or rename methods, change their arguments, or make other changes to your code you will need to restart.

The best known tool for reloading code changes instantly probably is JRebel. It works great, and there is no doubt that this is a very useful weapon in the Java developers arsenal. But it is not free. If you can do with some minor restrictions, DCEVM is a very good alternative.

Here I will explain how easy it is to install on Ubuntu and use it in eclipse. Install it via apt:

sudo apt install openjdk-11-jre-dcevm

Add 

-dcevm 

to the VM arguements (Servers -> open launch configuration -> (Tab) Arguments -> VM arguments), and you are good to go.

 

Are you looking for a freelance Magnolia CMS developer? Feel free to contact me.

 

 

Capabilities of different JVM's