195

JRebel allows for newly compiled code to be redeployed without restarting the application. I am wondering if there are any alternative (free?). The FAQ page answers this question, but I am sure it's biased towards JRebel. This question was asked a year ago on this site, but I am bringing it back up to see if anyone has any new information.

On a side note, I really like JRebel, but if there is a free alternative, I am willing to try it.

One additional note, I am working on an open source project, and they offer free one year licenses to people who can prove they are on an open source project. Which works great for me (www.kuali.org), but I won't be on that project forever.

Anton Arhipov
  • 6,479
  • 1
  • 35
  • 43
Jay
  • 4,994
  • 4
  • 28
  • 41
  • 56
    Good question. We've been looking for an alternative to JRebel as well, since their sales department is extremely invasive. We have no problems paying for a product like JRebel, but not when they are pestering our developers and IT department 24/7. – neu242 Dec 09 '13 at 11:34
  • 4
    There is an alternative to jRebel by the own ZeroTurnAround: the free version of Jrebel to opensource projects and study case... https://my.jrebel.com/ – deldev Nov 23 '15 at 12:42
  • 2
    I know it's late reply, you can take a look at [Spring Loaded](https://github.com/spring-projects/spring-loaded) - , which is a JVM agent for reloading class file changes whilst a JVM is running. It transforms classes at loadtime to make them amenable to later reloading. Unlike 'hot code replace' which only allows simple changes once a JVM is running (e.g. changes to method bodies), Spring Loaded allows you to add/modify/delete methods/fields/constructors and more... – Simple-Solution Jul 24 '16 at 16:42
  • Eclipse debugger - replaces your live code instantly. – user1050755 Sep 01 '17 at 21:05
  • Try posting this on the sister site, [*Software Recommendations Stack Exchange*](https://softwarerecs.stackexchange.com/). – Basil Bourque Nov 02 '18 at 19:39

8 Answers8

101

Take a look at DCEVM, it's a modification of the HotSpot VM that allows unlimited class redefinitions at runtime. You can add/remove fields and methods and change the super types of a class at runtime.

The binaries available on the original site are limited to Java 6u25 and to early versions of Java 7. The project has been forked on Github and supports recent versions of Java 7 and 8. The maintainer provides binaries for 32/64 bits VMs on Windows/Linux. Starting with Java 11 the project moved to a new GitHub repository and now also provides binaries for OS X.

DCEVM is packaged for Debian and Ubuntu, it's conveniently integrated with OpenJDK and can be invoked with java -dcevm. The name of the package depends on the version of the default JDK:

Emmanuel Bourg
  • 9,601
  • 3
  • 48
  • 76
  • anyone else tried that? is it worth a try - since it is a reasearch project? – definitely undefinable Jan 25 '12 at 17:12
  • 5
    It works fine, I found it faster and less memory consuming than JRebel. The only restriction is to stick to Java 6u25. – Emmanuel Bourg Jan 26 '12 at 10:37
  • 3
    Thank you very much. I've ruined the whole day trying to get jRebel to work as desired. DCEVM came to rescue. – alehro Nov 07 '12 at 16:39
  • As per this comment, http://devblog.guidewire.com/2011/05/06/the-dynamic-code-evolution-vm/#comment-1040 , the author of DCEVM and his colleagues are now work for Oracle and highly likely it will be available in Java 8. – sojin Nov 19 '13 at 13:06
  • Yes, he is the author of JEP 159. – Emmanuel Bourg Nov 19 '13 at 13:43
  • 4
    Here are full build & install instructions for DCEVM on JDK 7u45 and MacOSX: http://neu242.livejournal.com/52962.html – neu242 Dec 09 '13 at 12:21
  • 1
    JEP 159 is not part of JDK 8. It may have postponed to JDK 9 but no confirmation yet. – KrishPrabakar Dec 22 '13 at 15:44
  • 5
    Found some full JVM 1.7 binaries here: http://dcevm.nentjes.com/ so no need to patch your JVM. I tried the win64 one and it worked great for me. I also blogged about it here if you need more details: http://javainformed.blogspot.com/2014/01/jrebel-free-alternative.html – dnang Jan 18 '14 at 19:51
  • 1
    This is the nicest thing I have heard in 2014. No configurations, just 30 seconds of a work. Great project and most likely be a part of Java 8 :) – sura2k May 07 '14 at 11:44
  • Up-to-date fork available @ https://dcevm.github.io/ – Michiel Oct 01 '14 at 11:12
  • 1
    And now directly in Debian: https://packages.qa.debian.org/o/openjdk-7-jre-dcevm.html – Emmanuel Bourg Oct 01 '14 at 20:09
  • 1
    The fine print is that you are forced into using the serial GC, which is the slowest GC that the JVM offers. – oldmud0 Aug 08 '17 at 02:47
42

Hotswap Agent is an extension to DCEVM which supports many Java frameworks (reload Spring bean definition, Hibernate entity mapping, logger level setup, ...).

There is also lot of documentation how to setup DCEVM and compiled binaries for Java 1.7.

edudant
  • 719
  • 6
  • 6
  • 5
    They now have a dedicated web site: http://www.hotswapagent.org. The project is quite new but it appears to work quite well. – Didier L Mar 07 '14 at 13:14
  • I followed this tutorial to integrate it in eclipse after isntalling it : http://tirthalpatel.blogspot.fr/2014/06/steps-to-setup-hotswap-agent-in-eclipse.html it works like a charm – jpprade Dec 09 '14 at 09:56
  • @edudant After installing 'Hotswap agent', do we need to install DCEVM? Because I have installed DCEVM using "sudo apt install openjdk-11-jre-dcevm" in Ubuntu 19.04 and also the plugin in IntelliJ Ultimate 2019.1.3. If installing 'Hotswap agent' let alone do the job of JRebel, what's the use of DCEVM!? –  Aug 08 '19 at 01:38
  • DCEVM can do hotswap out-of-the-box now, no need to install Hotswap Agent. – rustyx Nov 17 '20 at 13:11
  • Warning, hotswapagent itself, do not enhance class relaoding. in jvm. It jsut wathces classapth, and if you modify ithere, it reloads. But is obeys limitations of given JDK – judovana Jul 16 '21 at 16:12
21

DCEVM supports enhanced class redefinitions and is available for current JDK7 and JDK8.

https://github.com/dcevm/dcevm/releases

HotswapAgent is an free JRebel alternative and supports DCEVM in various Frameworks.

http://hotswapagent.org/

tak3shi
  • 2,305
  • 1
  • 20
  • 33
20

By the Spring guys, used for Grails reloading but works with Java too:

https://github.com/SpringSource/spring-loaded

Ramon
  • 8,202
  • 4
  • 33
  • 41
  • 3
    I don't want to grumble but spring-loaded does not support dependency reloading. – lbednaszynski Jun 26 '13 at 17:43
  • As I recall, there are system properties you can set to tell it what packages to make reloadable. It has other limitations and I would probably rather go with DCEVM in any event. – Ramon Jun 28 '13 at 06:50
  • 1
    "what packages to make reloadable" - correct. The problem as pointed out by @lbednaszynski is that it won't reload the dependent JARs. That's essential for Maven multi-module projects. – Marcel Stör Dec 14 '14 at 22:40
  • This project is in the attic for now ! – jpmottin May 11 '17 at 10:46
12

I have written an article about DCEVM: Spring-mvc + Velocity + DCEVM

I think it's worth it, since my environment is running without any problems.

Csa77
  • 649
  • 13
  • 19
Rafael Sanches
  • 1,823
  • 21
  • 28
9

I have been working on an open source project that allows you to hot replace classes over and above what hot swap allows: https://github.com/fakereplace/fakereplace

It may or may not work for you, but any feedback is appreciated

Stuart Douglas
  • 847
  • 5
  • 4
4

You might want to take a look this:

HotSwap support: the object-oriented architecture of the Java HotSpot VM enables advanced features such as on-the-fly class redefinition, or "HotSwap". This feature provides the ability to substitute modified code in a running application through the debugger APIs. HotSwap adds functionality to the Java Platform Debugger Architecture, enabling a class to be updated during execution while under the control of a debugger. It also allows profiling operations to be performed by hotswapping in versions of methods in which profiling code has been inserted.

For the moment, this only allows for newly compiled method body to be redeployed without restarting the application. All you have to do is to run it with a debugger. I tried it in Eclipse and it works splendidly.

Also, as Emmanuel Bourg mentioned in his answer (JEP 159), there is hope to have support for the addition of supertypes and the addition and removal of methods and fields.

Reference: Java Whitepaper 135217: Reliability, Availability and Serviceability

Alex
  • 178
  • 2
  • 9
-4

JRebel is free. Don't buy it. Select the "free" option (radio button) on the "buy" page. Then select "Social". After you sign up, you will get a fully functional JRebel license key. You can then download JRebel or use the key in your IDEs embedded version. The catch, (yes, there is a catch), you have to allow them to post on your behalf (advertise) once a month on your FB timeline or Twitter account. I gave them my twitter account, no biggie, I never use it and no one I know really uses it. So save $260.

Michael Andrews
  • 828
  • 8
  • 13
  • 14
    There's one more catch. It JRebel Social is free only for non-commercial use. Yes, sure, we won't check if you're actually using it for your personal project or at work, but the auditors might not like it if they see you misusing the software. – Anton Arhipov Nov 10 '13 at 18:13
  • 2
    I would never suggest otherwise. In fact - the only reason I bring this up is because there is no "individual" license anymore. I was able to get my company to pay for my work license. I then also paid for a personal license, for my personal use, for over 3 years. But when the price when north of $260 a year, that became impractical. This is the best solution for me (and others), but I would have also kept paying for it if the price was reasonable. – Michael Andrews Nov 10 '13 at 19:54
  • 44
    Also, the 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. Food for thought. – Michael Andrews Nov 10 '13 at 20:00
  • 150$/y for personal - no problem i would pay forever, 350/y nah i also switched to free trial, its not so hard to create another email every 3 months, f.e. hmamail 30 secs. – norbertas.gaulia Aug 08 '14 at 13:15
  • 2
    JRebel Social has been replaced with myJRebel. Its free for non commercial use, you just need to allow the sharing of stats: https://my.jrebel.com – Steve Swinsburg Feb 03 '15 at 10:12
  • 1
    All in all, JRebel is relatively cheap for a developer software license. – Jared Hooper Jun 23 '15 at 20:56
  • 1
    As of July 5 2018, myJRebel is no longer available. Right now it is $550/year for a single developer license. – Lucky Aug 09 '18 at 09:25