Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I just saw a video showing how Notch (of Minecraft fame) is debugging and changing Minecraft while it is running. He pauses the game, changes something in the code and then unpauses the game where the change takes immediate effect without the need to restart the program.

How does this work? Which kind of technique is used to achieve this?

share|improve this question
1  
And thus is the extent of Notch's QA process. –  DeadMG Feb 16 '12 at 10:58
    
According to an older Q&A at Stack Overflow, this could be done with JPDA feature that does "HotSwap" Class File Replacement –  gnat Aug 30 '13 at 7:56

2 Answers 2

up vote 4 down vote accepted

Java can do hot-swapping out of the box. If you use an IDE like Eclipse it will work for changing method-bodies. If you want to apply other code changes you might want to use a tool. JRebel is a product that supports more cases.

I don't want to do marketing for that product, but I personally do not know any other alternative. On the JRebel website there's a nice feature-comparison.

Hope that helps.

share|improve this answer
    
+1 JRebel is great for "hot coding" outside of an IDE such as Eclipse. –  Jalayn Feb 16 '12 at 9:52

It's called hot code replace and allows an IDE to change live running code via the debugging interface. It has been supported by the Sun JVM since Java 1.4.1

However, unless you use the (commercial) JRebel JVM extension, it's limited to changes inside method bodies. If you add/remove methods or classes, or change signatures, you have to restart the JVM.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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