Search code examples
javaeclipsehotswap

Eclipse - Java - Hotswap without breakpoints


I have a question. Is it possible to use the hotswap without using breakpoints ?

When notch made prelude of chambered (http://www.youtube.com/user/Nizzotch?feature=playlist-comment#p/u) he used the hotswap without having to : - add breakpoints - save - remove breakpoint - resume In this video it's too fast to see that, but i can't find old ones.

Do you have an idea ? eclipse-options, macro, plugins ... ?

Thank you


Solution

  • Depends on your JVM, but hotswap in Eclipse worked for me with no tricks on the Sun's HotSpot JVM back in the times of Java 1.5. Here's a related Sun's bug. Which JVM are you using?

    public class Test {
        private static int ctr = 0;
        public static void main(String[] args) {
            while (true) {
                method();
                try {
                    Thread.sleep(200);
                } catch (InterruptedException e) {
                    System.err.println("Interrupted");
                }
            }
        }
        
        private static void method() {
            System.out.println(ctr);
        }
    }
    

    I changed System.out.println(ctr); to System.out.println(ctr++);, and my output altered to an increasing sequence.