Java. Change class declaration at runtime

336 views Asked by At

Everybody knows Jrebel. But I wanted to make some small similar implementation - just a functionality that allows to reload Class definition after recompilation.

I made java agent that monitors classes. Also I specify system classloader that loads all my custom classes. And after recompilation my agent should reload class with new definition. But nothing happens.

Also I tried to use instrumentation API within my java agent:

instrumentation.redefineClasses

or

instrumentation.retransformClasses

but it doesn't help.

All the source files can be found here - https://github.com/ice-pro/Runtime-Redeploy

To run test please execute 'install' on main module and then 'compile' on Tester module.

Please advice me how can I redefine class declaration at runtime.

0

There are 0 answers