You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Test.java 810B

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