Links

  • 1. Sogeti
  • 2. JBoss
  • 3. IBM
  • 4. Oracle
  • 5. SpringSource
  • 6. NL-JUG
  • 7. Java

Archives

Syndication  RSS 2.0

RSS 1.0
RSS 2.0

Bookmark this site

Add 'JCN Blog' site to delicious  Add 'JCN Blog' site to technorati  Add 'JCN Blog' site to digg  Add 'JCN Blog' site to dzone

Posted by Erik-Berndt Scheper at 18:27 on Monday 9 December    Add 'True Hot Swap in Java with DCEVM on OS-X' site to delicious  Add 'True Hot Swap in Java with DCEVM on OS-X' site to technorati  Add 'True Hot Swap in Java with DCEVM on OS-X' site to digg  Add 'True Hot Swap in Java with DCEVM on OS-X' site to dzone

Last Tuesday in the ‘living room session’ held at our HQ in Vianen, Volkert de Buisonje brought my attention to the Dynamic Code Evolution VM (DCEVM) project which describes itself as “a modification of the Java HotSpot(TM) VM that allows unlimited redefinition of loaded classes at runtime”.

A frequent problem with debugging in any IDE is that the current hotswapping mechanism of the HotSpot(TM) VM allows only changing method bodies. The DCEVM allows adding and removing fields and methods as well as changes to the super types of a class. This would make it a poor man’s alternative for JRebel.

Intrigued by the idea, I’ve tried it and it works!!. The current code base has been kept up-to-date by GuideWire at Github. It took me some time to get the right prerequisites for OS-X 10.9 but eventually I’ve successfully built it against the most recent OS-X JDK 1.7.0_45. It’s now my standard JDK for GlassFish debugging sessions in IntelliJ and I can hot swap any changed code. Of course it’s not as full featured as JRebel, but it still saves me plenty of redeployment time during the day.

If you want to try building it yourself, you can follow the steps below. An alternative is to install a plugin from IntelliJ. More details about this plugin are in the JetBrains Blog.

Prerequisites

  • Gradle is installed (I used version 1.9)
  • Xcode developer tools are installed, using xcode-select --install in terminal

 

Checkout DCEVM repository from GitHub
cd /java/git/jdk
git clone https://github.com/Guidewire/DCEVM/
git checkout -b full-jdk7u45 origin/full-jdk7u45

 

Build DCEVM for OS-X
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home
cd /java/git/jdk/DCEVM/hotswap
gradle -Pkind=product clean compileDCEVM

This takes a lot of time, but eventually it should finish with:

Using java runtime at: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre
BUILD SUCCESSFUL

Total time: 6 mins 23.907 secs

 

Clone the JDK and copy DCEVM libraries to the cloned JDK

cd /Library/Java/JavaVirtualMachines
sudo cp -R jdk1.7.0_45.jdk jdk1.7.0_45_dcevm.jdk


cd /java/git/jdk/DCEVM/build/bsd/bsd_amd64_compiler2/product/
ls -la *.dylib
sudo cp *.dylib /Library/Java/JavaVirtualMachines/jdk1.7.0_45_dcevm.jdk/Contents/Home/jre/lib/server

 

Test the new DCE VM
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45_dcevm.jdk/Contents/Home
java --version

Expected output:

java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Dynamic Code Evolution 64-Bit Server VM (build 24.45-b06-dcevm-dev, mixed mode)


© 2019 Java Competence Network. All Rights Reserved.