1*f1fbf3c2SXin Li import java.io.*; 2*f1fbf3c2SXin Li import javassist.util.HotSwapper; 3*f1fbf3c2SXin Li 4*f1fbf3c2SXin Li public class Test { main(String[] args)5*f1fbf3c2SXin Li public static void main(String[] args) throws Exception { 6*f1fbf3c2SXin Li HotSwapper hs = new HotSwapper(8000); 7*f1fbf3c2SXin Li new HelloWorld().print(); 8*f1fbf3c2SXin Li 9*f1fbf3c2SXin Li File newfile = new File("logging/HelloWorld.class"); 10*f1fbf3c2SXin Li byte[] bytes = new byte[(int)newfile.length()]; 11*f1fbf3c2SXin Li new FileInputStream(newfile).read(bytes); 12*f1fbf3c2SXin Li System.out.println("** reload a logging version"); 13*f1fbf3c2SXin Li 14*f1fbf3c2SXin Li hs.reload("HelloWorld", bytes); 15*f1fbf3c2SXin Li new HelloWorld().print(); 16*f1fbf3c2SXin Li 17*f1fbf3c2SXin Li newfile = new File("HelloWorld.class"); 18*f1fbf3c2SXin Li bytes = new byte[(int)newfile.length()]; 19*f1fbf3c2SXin Li new FileInputStream(newfile).read(bytes); 20*f1fbf3c2SXin Li System.out.println("** reload the original version"); 21*f1fbf3c2SXin Li 22*f1fbf3c2SXin Li hs.reload("HelloWorld", bytes); 23*f1fbf3c2SXin Li new HelloWorld().print(); 24*f1fbf3c2SXin Li } 25*f1fbf3c2SXin Li } 26