title: Dynamic class reloading works only in debug mode, why/ how it really works?
body: <p>I have a tricky question.</p>
  
  <p>My java program is doing in a loop such things:</p>
  
  <p>loop:</p>
  
  <ol>
  <li><p>read external file with compiled java class into byte[] array.</p></li>
  <li><p>create a new instance of my own classloader.</p></li>
  <li><p>setbytes from the readed file to this instance of classloader.</p></li>
  <li><p>using created classloader create a new instance of object of the class from external file.</p></li>
  <li><p>call any method of the created object.</p></li>
  </ol>
  
  <p>And where the problem is.</p>
  
  <ol>
  <li><p>When I run this program in debug mode it behaves as I expect, so if external file changed classloader loads new version of class and executes new version (if file didn't change it loads old version also of course).</p></li>
  <li><p>But when I run this program NOT in a debug mode it always executes old version despite the fact that the readed file has changed.</p></li>
  </ol>
  
  <p>Maybe someone with a deeper knowledge of classloading issues and JVM behaviours can explain me this behaviour.</p>