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.
The following classpath definition works fine;
java -cp patch/patch.jar;bin/ com.test.PatchClasspath
but when order of lib classes are changed it does not work.(as usual)
java -cp bin/;patch/patch.jar com.test.PatchClasspath
I would like to know is there a JVM parameter which indicates the lib loading order?
EDITED: I amd modifying Util->print() method to verify patch is applied.
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");
}
}
Thanks.