How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux

Posted on

Introduction on the DCEVM

This article has a specific content on how to install DCEVM for Java Redefinition in Java. It is an alternative tool for replacing JRebel. Currently, JRebel is available only for commercial use. So, it is important to find an alternative replacement for community or opensource usage. Moreover, what is actually the function of DCEVM ?.

Java source code compilation process will generate Java bytecode . Furthermore, it is actually exist in the .class format. The execution of the Java bycode to run the program is possible with the help of the available JVM in the operating system. So, Java bytecode acts as an intermediate code. The JVM will execute the .class Java bytecode to run the program. It is possible because JVM specifically knows the current environment and the architecture where the .class Java bytecode exist. It is obvious, since it has the capability to run the program by execute .class Java bytecode.

Reloading a Java bytecode in a virtual machine when application is running has its own limitation. In fact HotSpot(TM) VM or the orignial JVM allows only changing method bodies. To address this problem some commercial and open source tools were created. One them is the Dynamic Code Evolution Virtual machine (DCEVM).

Basically, The Dynamic Code Evolution Virtual Machine (DCE VM) is a modification of the Java HotSpot(TM) VM . It allows unlimited redefinition of loaded classes at runtime. In fact, it is maybe where the term ‘hot swap’ comes form. The current hotswapping mechanism of the HotSpot(TM) VM allows only changing method bodies. On the other hand, DCEVM enhanced VM allows adding and removing fields and methods as well as changes to the super types of a class. So, by using this JVM, every change including fields and method in the Java source code is possible for hotswapping mechanism.

 

Steps on installing DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux

The following are the steps for executing the DCEVM :

1. Download the DCEVM installer.

It is available in the following link and also this link . Choose the most suitable version with the current JVM version running in the operating system. It is available in a compressed file format either in tar.gz or in a jar format.

2. Execute the DCEVM installer. The following is the execution of the DCEVM installer :

java -jar DCEVM-installer-file
user@hostname:~$ chmod +x DCEVM-8u181-installer-build2.jar
user@hostname:~$ java -jar DCEVM-8u181-installer-build2.jar
Gtk-Message: 14:06:36.758: Failed to load module "canberra-gtk-module"
user@hostname:~/Downloads$

After the execution of the DCEVM installer, the following  image will appear  :

How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux
How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux

2. After executing the first step, just click the Add installation directory… as shown in the above image :

How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux
How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux

3. Click the button to make the Select Java installation directory appear as shown in the above picture. Select the Java installation directory which is not in the list. Especially, if the Java installation directory in the list is not the one which is going to be modified. Below is the image of the new addition entry of Java installation directory :

How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux
How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux

4. Click the entry in the list by selecting the appropriate Java installation directory. In this case, the update process of the JVM is necessary in order to support the hot swap mechanism. In other words, it is just a replacement process from the original JVM to the DCEVM version. Below is the image on selecting the JVM :

How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux
How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux

5. Click the button Replace Install DCEVM as altjvm. It shows as in the following image :

How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux
How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux

 

Checking the DCEVM

After the installation of the DCEVM, don’t forget to check the JVM version. Checking the running DCEVM is possible by performing the following steps :

1. To prove the current JVM is using the DCEVM version. Just type the ‘java -version’ in the command line. It shows as follows :

user@hostname:~/Downloads$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Dynamic Code Evolution 64-Bit Server VM (build 25.71-b01-dcevmlight-26, mixed mode)
user@hostname:~/Downloads$

2. Another way to prove the current JVM is actually the DCEVM version is using an IDE. The IDE which stands for Integrated Development Environment is a tool to develop program. It must supports the Java programming language. So, just change the source code in the IDE. If the DCEVM version is running, it will automatically load the new .class Java bytecode. The loading process is triggered automatically without further compilation.

3. If it is not working, just re-execute from the previous step in the DCEVM installation process. Click the Replace by DCEVM button. It will completely replace the currently running JVM with the DCEVM version. It shows in the following image :

How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux
How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux

If the Replace by DCEVM has already been clicked, the following image will appear :

How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux
How to Install DCEVM for Java Hot Swap mechanism in runtime as an alternative of JRebel in Linux
  1. Finally, test it to prove that the DCEVM has already changed.

Leave a Reply