title: How to enable java code hotswapping in Eclipse
body: <p>I've been trying to play around with hotswapping Java code in Eclipse, but I have no idea what the limitations and rules of hotswapping Java code in Eclipse are, so my efforts frequently fail. If anyone could offer a relatively detailed explanation of how to hotswap code in Eclipse or link me to one that would be great.</p>
  
  <p>For instance, this code hotswaps if I change the value of <code>u</code>:</p>
  
  <pre><code>public class apples extends tuna {
  
      public static void main(String[] args) throws InterruptedException {
          while (true) {
              ddop();
              Thread.sleep(1000);
          }
      }
  
      public static void ddop() {
          int u = 3;
          System.out.println(u);
      }
  }
  </code></pre>
  
  <p>but this code doesn't:</p>
  
  <pre><code>public class apples extends tuna {
      static int u;
      public static void main(String[] args) throws InterruptedException {
          int u = 3;
          while (true) {
              System.out.println(u);
              Thread.sleep(1000);
          }
      }
  }
  </code></pre>
  
  <p>Could anyone provide an explanation why? And yes, I do have the "build automatically" flag checked and am running in debug mode.</p>