Since the early days of my college life I have been using Java and biggest problem that we have is absolutely being less productive than other interpreted languages. All people are sure that java is one of the best compiled language.

However, neither Sun nor Oracle has put enough effort in to solve this problem. One of the problem is, of course, class reloading.

Latest attempts from community to solve this problem are DaVinci Hotswap project, JRebel, PlayFramework. However, at the time of this writing they were still not mature (imo) and native. Some of them are not enterprise ready, some of them are not compatible with all IDEs, some of them are immature universtiy projects. The road map and even developer ready Java is ready, but the Java community still does not have a solution for on the fly class reloading.

Is it so difficult for Oracle to put effort forth to solve this problem? Why has class reloading not been implemented natively yet?

  • 2
    Actually JRebel is completely enterprise ready and has pretty good IDE support, albeit it is not free. – CarlosZ Mar 26 '11 at 18:32
  • @CarlosZ Really? I have used IntelliJ IDEA with JRebel from the first beta's to 3.x series. Instead of "this", you have to use "that". At forum for each release you will see many issues regarding intelliJ plugin. But the worst experience was debugging issues. Debugger could connect very late. And We had tremendous problems. As a intellJ user I have concrete experience regarding JRebel in IDEA. And of course paying money is another issue too. – Ozgur Mar 26 '11 at 18:53
  • @CarlosZ It is a really question, I am curious to learn why it is difficult to implement class reload in java natively. – Ozgur Mar 26 '11 at 18:54

What about JEE/J2EE? This was first released 12 years ago. This is supported directly be Sun/Oracle and many other vendors.

What about and OSGi? Its first release was almost 11 years ago. Eclipse (an IDE) is built on it, Glassfish from Sun/Oracle and Apache Felix use it extensively. You can use it with Spring-OSGi.

It hasn't been supported natively in Java SE because enterprise applications were deliberately supported by application servers as separate products.

  • @Peter Lawrey 1) Lawrey Regarding J2EE is there a concrete solution? I could not see your point? 2) In order to class reloading do you think that OSGI should be used? What about Jigsaw? Even at JCR level, there is not still a consensus :) . OSGI is addressing a very different area than class reloading. 3) I could not understand JavaSE part, could you explain a little more? And please note that DaVinci HotSwap project is sponsored by Oracle. It means,at least for me, they are also eager such a solution. – Ozgur Mar 26 '11 at 19:47
  • It depends on what you expect hot swap to do. If you want hot swap for debugging, you have been able to do this for some time. However for robust enterprise solutions hot swap of this nature is not appropriate and only controlled releases are. In this case JEE and OSGi allow you to update running applications which has much the same benefit but with the control you would expect from a production environment. For example, in my OSGi container I can remove classes and replace them with newer versions without stopping the application. What do you need which OSGi does not do? – Peter Lawrey Mar 26 '11 at 20:33
  • 1) JEE/J2EE reference implementation might be a place to start, but there are many more popular, easier to use JEE. My point being you can replace the code in a running system. What more do you need in a production/controlled environment. – Peter Lawrey Mar 26 '11 at 20:35
  • 1
    2) Reloading classes is the only things I use OSGi for. What do you see as the main use for OSGi? – Peter Lawrey Mar 26 '11 at 20:39
  • 3) The whole point of JEE is this is the space for support of enterprise applications. JSE is the underlying platform which can be used for JEE or other applications. – Peter Lawrey Mar 26 '11 at 20:43

Try this: http://www.zeroturnaround.com/blog/reloading_java_classes_401_hotswap_jrebel/

There are multiple complex issues involved. I'm actually not aware of any solutions out there (for Java or not) that do structural changes to stateful entities. Dynamic languages like Ruby or PHP don't really do that, I'm not sure about Erlang, but I think it also will lose state.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.