Technically, you CAN do it yourself. Although, I would not recommend it, as it can quickly get complicated. But the idea is that you can create a ClassLoader and load a new version of your class. Then make sure your executable is aware of the new ClassLoader.
I would recommend using JBoss and redistributing your banks and wars. Nice and simple for the most part.
In any case, you will be convinced that you do not have memory leaks, because after several redistributions you will leave the PermGen space.
source share