Get True Hot Swap in Java with DCEVM and IntelliJ IDEA
Many developers can barely imagine daily work on large projects without hot-swapping Java classes from the IDE. However, as you know Java HotSwap™ VM has a serious limitation since no structural changes in classes are allowed. This means that you can’t, say, add a new method or a field to a class and perform the hot swapping. The only thing you can actually change during the hot swapping are the method bodies.
Luckily there is a way to improve the situation with the new open-source project Dynamic Code Evolution VM, a modification of Java HotSwap™ VM with unlimited support for reloading classes at runtime.
We have already tested the new virtual machine in a local environment for IntelliJ IDEA project development and can confirm that it delivers significant productivity gains.
The support for Dynamic Code Evolution VM in IntelliJ IDEA is available now for everyone via this new plugin so you can try the true hot swapping by yourself.
Follow these steps to get started with this plugin:
When you enable the plugin, the IDE will offer you to download DCEVM JRE for your environment.
Then, if you want to use this JRE for your run configurations, you have to choose it in the list of alternative JREs.
Now you can enjoy the enhanced hot swapping in your project.
It’s important to note that DCEVM is still a prototype project at the moment and it’s not ready for use in production servers. However, it is of excellent help during development. If DCEVM JEP has enough interest, it may be incorporated into the standard JVM distribution later.
Develop with Pleasure!
Tropper says:
July 11, 2013Or you could buy JRebel. Granted, it’s not cheap – but it’s awesome! 🙂
Edgar Garza says:
January 13, 2015the fact that every year I need to repurchase software I already bought is frustrating. No other company does this. Usually you buy software once. If you opt in to upgrade – then you buy it again for full price (or maybe an upgrade price, depending on the company). But what you’re paying for then are NEW features – not the same features you already paid for. It would be like Apple or Microsoft disabling your computer each year until you paid for the OS again
Jul says:
May 28, 2015I have the same opinion and that’s why I hate companies like those.
Julian says:
May 30, 2015So true!
Simon S. says:
May 6, 2016That’s obviously a very stupid notion and the last few years have proven that. Subscription models are awesome, and even JetBrains has wisely followed suit.
Mike says:
July 11, 2013Would like to see how it compares to JRebel. I can’t really live without JRebel, not sure how I coded in Java so long without it.
Jan says:
July 11, 2013JRebel also does other kinds of hotswapping: Spring, Thymeleaf, …
Mike Heath says:
July 11, 2013In my experience DCEVM runs circles around JRebel. DCEVM modifies the JVM so it does a lot of things that JRebel can’t do.
Ravshan says:
February 3, 2014very true!
Daniel says:
August 20, 2015What does DCEVM do that JRebel cannot? JRebel can do things that DCEVM cannot, but not the other way around.
Alex says:
July 11, 2013How it is better than just downloading, unpacking and running DCEVM jar once to patch the JMV(s)?
what problem does this plugin solve?
Ivan Dubrov says:
July 11, 2013Where did you guys get your DCEVM binary? It seems like it is based on some version of 1.7, but I can’t see which version exactly. Did you build it yourself or downloaded binary somewhere else?
Some time ago I had to fork and update DCEVM (both light version and full version) for the company I am working for (there was no version available for the latest Java 7 JDK at the time, plus there were some issues I had to fix), which I currently published at https://github.com/idubrov/DCEVM . Basically, it’s the same sources as in DCEVM Mercurial repository plus bunch of stability related fixes.
Sam says:
November 4, 2013Hi Ivan Dubrov,
Is DCEVM works with oracle JDK 7u45 64 bit on windows 64 bit?
Henrik says:
December 9, 2013Ivan: Here’s how to compile and install: http://neu242.livejournal.com/52962.html
Joerg says:
July 11, 2013Is it possible to setup Plugin-dev project with this ?
The usual “Intellij Platform Pluign SDK” setup only suggests standard JDKs, DCEVM is not listed after installation.
Can it be achieved by putting e.g. community-version in the classpath and running with DCEVM ?
Best, J
smart says:
July 11, 2013Dos it support hot swap in Tomcat when using Spring MVC?
How can I config it?
Andrey Cheptsov says:
July 12, 2013@Alex All problems are handled by DCEVM, the plugin does nothing special except downloading the JRE and it’s setup of run configurations.
Alexander Malfait says:
July 12, 2013Have been using DCEVM for years, it’s a marvel of a thing. I must have saved a hundred hours on restarts by now. It’s very reliable too, 100% recommended!
Thanks for spreading awareness JetBrains.
Maciej says:
July 12, 2013How to change JRE in which Tomcat will run?
Denis.Zhdanov says:
July 12, 2013Gents,
Couple of words about DCEVM and IJ DCEVM plugin:
1. JRebel vs DCEVM – JRebel is a solid commercial tool which is backed by a team of professionals. It provides not only HotSwap alternatives but j2ee containers-specific HotSwap as well. DCEVM is a prototype of a JVM with improved HotSwap. It is created by a single person and doesn’t cover all the cases which arise even during normal j2se HotSwap. That means that JRebel provides more features and is more stable (at least at the moment). However, it’s important to understand that they use very different approaches – JRebel constantly modifies byte code of loaded classes in order to make it eligible for further regular ‘old HotSwap’ but DCEVM patches HotSwap at the JVM level. That means that JRebel approach works with every JVM but is much more complex (it’s necessary to support stuff like reflection and debugging when resulting byte code is very much not the same as the one created by compiler) and more slow. HowSwap patching is fast and efficient but is available only at special JVM at the moment. From my point of view, it’s better to have better HotSwap at JVM level and container-specific hot swapping tools;
2. The DCEVM binaries provided by the plugin have been built by ourselves from public DCEVM repo. The plugin just eases it’s IJ integration, i.e. a user can just click ‘Download’ link and have the things done automatically;
3. AFAIK DCEVM repo is not bound to any specific OpenJDK branch and its tags are not bound to OpenJDK repo tags. DCEVM repo has been cloned from java7 branch but I’m not sure about exact details;
4. @Ivan: I think it’s better to offer your fixes to the DCEVM’s author (Thomas Wuerthinger). He is a very good and easy to deal with guy and I have no doubt that he would accept the fixes;
natros says:
July 12, 2013Not working on CentOS 6.4 64bit 🙁
plugins/DCEVM_JRE/bin/java: /lib64/libc.so.6: version `GLIBC_2.14′ not found
Denis.Zhdanov says:
July 12, 2013Sorry, we didn’t test it under CentOS, only windows, mac and linux
rk says:
September 17, 2013Hi,
Can you please provide the direct download path for jre for mac os x 10.8
Thanks
Johan Boulé says:
December 1, 2018CentOS is linux!
metyl says:
July 12, 2013How to use it with app. server eg. tomcat install as normal jre and configure tomcat to use it?
Denis.Zhdanov says:
July 12, 2013We haven’t tested it under servers and, as far as I know, hot swapping is often server-specific. That means that there is a possible case that DCEVM won’t help with them. However, you can try to check it and yes, you just need to configure server process to use that alternative jvm then.
metyl says:
July 12, 2013Denis but how to provide new clasess to DCEVM will IJ do it?
Denis.Zhdanov says:
July 12, 2013DCEVM is a jvm with enhanced HotSwap, that means that no additional setup is required for tools which already know how to work with regular HotSwap. Talking about IJ, you just need to ensure that ‘project settings | debugger | hotswap | reload classes after compilation’ is set to ‘always’ or ‘ask’. Then the ide will do the job each time when you start an application under debug, modify sources and recompile them.
Gauthier JACQUES says:
July 12, 2013Hi Denis,
I can’t start a plugin run configuration with it. It fails with a ClassNotFoundException on com.intellij.idea.Main
Any idea why ?
Thanks
Denis.Zhdanov says:
July 12, 2013I’ve created a small screencast which illustrates DCEVM in action – https://dl.dropboxusercontent.com/u/1648086/video/hotswap.m4v
mgrenonville says:
July 12, 2013Hello !
First, very nice tool, thanks a lot !
I patched my JVM with the DCEVM tool, and also use the plugin, but I am unable to remove a super class (or interface) from a class, but i can add parents like a charm.
Since it’s not a common case for me, it’s ok, but i was wondering if it is normal.
Thank you !
klikh says:
July 12, 2013I’ve been using DCEVM for IJ run configurations for a while, and I confirm that it really is a time-saver. I think publishing this plugin is a right move which would let DCEVM gain popularity among Java developers. Thanks!
metyl says:
July 12, 2013Thx Denis, now the only feature that we all need is ‘Make project automatically’ working also during run/debug sessions.
Fred says:
July 12, 2013Is it planed to make it work with Intellij Pluign Run/Debug Conf ?
Christian says:
July 12, 2013When trying to use this with a Maven project the DCEVM option doesn’t show up as an available JRE. Is there something that would prevent this from working for Maven projects? Otherwise it works fine with “Application” projects 🙂
Denis.Zhdanov says:
July 15, 2013@mgrenonville: ‘Since it’s not a common case for me, it’s ok, but i was wondering if it is normal.’ – well, I’m afraid I don’t have enough information to answer this question but tending to say that that is an expected behavior since DCEVM is a prototype VM which doesn’t cover all the cases.
@Christian: do you mean that no DCEVM is available at maven IJ run configuration or at Application run configuration at maven-aware IJ project?
Denis.Zhdanov says:
July 15, 2013@Fred: ‘Is it planed to make it work with Intellij Pluign Run/Debug Conf ?’ – we’ll check that use-case shortly
Christian says:
July 15, 2013@Denis.Zhdanov: DCEVM isn’t available at Maven run configuration.
Just thought I’d give it a try with a “maven based” project I have 🙂
Denis.Zhdanov says:
July 16, 2013That’s true, we didn’t add maven run configuration support. Will check that use-case as well
Andreas Steffan says:
July 18, 2013Hallo everybody,
I have to say I am amazed to realize dcevm efforts are still underway. Even better this beast even seems very helpful today. Last time I checked it seems pretty dead. IMHO it still does when you work your way from the dcevm homepage.
Anyways, reality seems different. (Un-)fortunatly, the demand for the plugin obviously was high enough for dropbox to disable public links. Try
https://dl.dropboxusercontent.com/u/62224416/j2re-dcevm-linux64.zip
Fails with 509 “This account’s public links are generating too much traffic and have been temporarily disabled!” for me.
Hence, I wondered where to find a decent built for linux64. Googling suggested I might want to try the one at https://github.com/sweetybanana/DCEVM/tree/master/lib 😉
Will try try that out now setting up things manually.
cheers
Andreas
Denis.Zhdanov says:
July 18, 2013Guys,
Couple of questions about expanding DCEVM support for run configurations over than ‘Application’:
*) plugin – it’s not possible to make ‘Plugin’ run configuration DCEVM-aware at the moment due to it’s design specifics. We can create corresponding feature request and, if/when it’s proved to be of IJ community interest corresponding changes can be made;
*) maven – it’s not clear what use-case do you point with maven run configurations – jvm which is used to start maven process? jvm used by maven to launch nested process? something else?
Pavel Arnost says:
July 19, 2013Hi Denis,
DCEVM JRE for Windows 64-bit (https://dl.dropboxusercontent.com/u/62224416/j2re-dcevm-win64.zip) cannot be downloaded (dropbox says “This account’s public links are generating too much traffic and have been temporarily disabled!”). Can you uploaded it once more please?
Thanks,
Regards
Pavel
Shane Witbeck says:
July 19, 2013When I try downloading from popup event I get:
DCEVM
Can’t download DCEVM because of server error
Any suggestions for a workaround?
I’m using build 129.961 on Mac 10.8.4
rk says:
September 17, 2013Hi,
Were you able to get a workaround to download the dcevm jre in Mac ?
I am getting the same error.
”
Can’t download DCEVM because of server error ”
using latest Version:
12.1.4
Build:
129.713
Muthu Ganapathy says:
October 24, 2015Try downloading form here https://github.com/dcevm/dcevm
Rob Leland says:
July 19, 2013Will DCEVM work with the OracleJDK ? When I tried it with 1.7u25 IntelliJ indicated that the JDK was corrupt. I am having difficulty finding a recent build of OpenJDK for windows. So far I only see the RI release from 2011.
Rob
Denis.Zhdanov says:
July 22, 2013@Rob: what do you mean under ‘DCEVM works with OracleJDK’? DCEVM is an OpenJDK repo fork and AFAIK it’s not synced with OpenJDK repo too often
Christian says:
July 26, 2013@Denis.Zhdanov: To launch the developed application. If that requires maven to be started with the same process, so be it. 🙂
Fred says:
July 28, 2013can you get DCEVM working with JDK 1.7 64 bits under windows ?
go green says:
August 22, 2013Upon clicking on the download link:
DCEVM: Can’t download DCEVM because of server error
Jamshid says:
August 28, 2013I tried DCEVM with Spring based Tomcat project, I changed method signature and it is throwing reflection exception:
java.lang.reflect.GenericSignatureFormatError
at sun.reflect.generics.parser.SignatureParser.error(SignatureParser.java:103)
at sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:233)
at sun.reflect.generics.parser.SignatureParser.parseTypeSignature(SignatureParser.java:359)
at sun.reflect.generics.parser.SignatureParser.parseTypeSig(SignatureParser.java:157)
at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:367)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:181)
at sun.reflect.annotation.AnnotationParser.parseParameterAnnotations2(AnnotationParser.java:133)
at sun.reflect.annotation.AnnotationParser.parseParameterAnnotations(AnnotationParser.java:110)
at java.lang.reflect.Method.getParameterAnnotations(Method.java:751)
at org.springframework.core.MethodParameter.getParameterAnnotations(MethodParameter.java:283)
RUpesh Dhadiwal says:
March 3, 2016After hotswapping spring controller i am also getting same issue with chaging method signature
Michael Driscoll says:
September 10, 2013To run DCEVM with Tomcat, go to Edit Configurations -> Tomcat -> Startup/Connection -> Debug -> Pass environment variables -> JAVA_HOME = /Users/{you}/Library/Application Support/IntelliJIdea12/DCEVM_JRE
Vladimir says:
November 19, 2013Thank you Michael!
hadeser says:
August 16, 2014don’t work for me. (idea 13)
rk says:
September 17, 2013Hi,
Was any alternative location put for the dcevm jre builds ?
I am still getting the same error in mac.
”
Can’t download DCEVM because of server error ”
using latest Version:
12.1.4
Build:
129.713
Ben says:
November 19, 2013I’m trying to run DCEVM with Tomcat and get this warning:
Dynamic Code Evolution 64-Bit Server VM warning: JSR 292 is disabled in this JVM. Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable.
Does anyone know where to set these options?
Juan says:
March 31, 2014Bean, i have same error:
Dynamic Code Evolution 64-Bit Server VM warning: JSR 292 is disabled in this JVM
anyone could solve it ?
Peter Alexis says:
November 19, 2013Would be great if we can get maven run configuration support. It would help to get jetty:run or tomcat7:run in hotswap mode and I believe web development in Java will be more fun and productive.
Lordmau5 says:
December 1, 2013Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Must use the serial GC in the Dynamic Code Evolution VM
Process finished with exit code 1
How to fix this :(?
Jiri Bubnik says:
February 24, 2014Take a look at Hotswap Agent:
– Framework support – Spring, Hibernate, Logback, Jetty, Tomcat, JSF, …
– Documentation how to setup DCEVM and precompiled binaries for Java 1.7
– Load classes and resources from various location (allow reload of classes from dependent project]
– Open source and free
Claude says:
May 1, 2014See here for latest version https://dcevm.github.io/
Jason Winnebeck says:
May 30, 2014I’m trying to use DCEVM with IntelliJ as a replacement for JRebel, and it works very well except one problem — I’m running with Weblogic with exploded war. Problem is that DCEVM can reload whatever I throw at it. But if I ADD a class, then Weblogic cannot load it because class is not copied to exploded war artifact. OK, so I do a make and rebuild artifact. Problem is that this causes Weblogic to do a redeploy of the application, which defeats the whole point of using DCEVM. Compounding this is that I am developing with Groovy, and each closure is a class, so it’s easy to write a line of code and introduce several new .class files. Anyone know a solution to this problem? Either is it possible for IDEA to use hotswap to ADD a class (probably not possible due to how classloaders work), or get Weblogic to be able to load new classes without triggering a whole redeploy?
Payam Rastogi says:
January 5, 2015I had configured DCEVM on intellij, but I think the way I did it is wrong as when I made some change in the java file and ctrl + shift + f9, the tomcat is getting restarted. Can you please tell me the correct way to configure it.
Jafar Sadik says:
October 5, 2015From my experience DCEVM is just awesome and I hope that its functionality will be eventually introduced to standard JVM.
How to use it:
a. goto https://github.com/dcevm/dcevm, then click ‘releases’ and choose one that applies to your jdk
b. run downloaded jar and install alternative jvm dll
c. in debug mode (either local or remote) just add vm option: -XXaltjvm=dcevm
You’ re now ready to hot swap most everything in your application.
Develop with pleasure! 😀
zack says:
September 8, 2016can mybatis‘ *mapper.xml be hotswap too?
Anil says:
December 14, 2015I used JRebel first and then DCEVM after my JRebel trial expired. I see JRebel was quick and loads modified class in no time, but when it comes to DCEVM its loading the whole application, spring config, other frameworks part of the application. Any setting we can do with DCEVM just swap class i modified?
Ivan Lagunov says:
October 20, 2016If you encounter the following error:
Must use the serial GC in the Dynamic Code Evolution VM
Then you should enable serial GC by:
– adding the JVM argument -XX:-UseSerialGC
– removing all ParallelGC JVM arguments
Amirtha Rajan says:
July 2, 2017Hi,
added+ Serial GC -XX:+UseSerialGC
removed- Parallel GC -XX:-UseParNewGC -XX\:-UseConcMarkSweepGC
And it worked for me
dorrabuji says:
June 1, 2017This has been the most helpful article I can find on majors! Java programming language is specifically designed to have as few implementation dependencies as possible.