title: Controlling the loading of Java class in CLASSPATH
body: <p>I am trying to apply patch using classpath approach, I mean I am adding modified class files as jar file, and while classes are getting loaded new version of classes are loaded. Therefore application is patched without changing original jar file.</p>
  
  <p>The following classpath definition works fine;</p>
  
  <pre><code>java -cp patch/patch.jar;bin/  com.test.PatchClasspath
  </code></pre>
  
  <p>but when order of lib classes are changed it does not work.(as usual)</p>
  
  <pre><code>java -cp bin/;patch/patch.jar  com.test.PatchClasspath
  </code></pre>
  
  <p>I would like to know is there a JVM parameter which indicates the lib loading order?</p>
  
  <p>EDITED:
  I amd modifying Util->print() method to verify patch is applied.</p>
  
  <pre><code>package com.test;
  
  public class PatchClasspath {
  
  public static void main(String[] args) {
      Util util = new Util();
      util.print();
  }   
  
  }
  
  
  package com.test;
  
  public class Util {
  
  
  public void print(){
      System.out.println("Version-1");
  }
  
  }
  </code></pre>
  
  <p>Thanks.</p>