You can't reliably make the JVM garbage collect an object, so I think this approach will have trouble. I looked at
JUnit source code because the GUI runner tests new versions of classes without stopping and restarting. It just uses a new ClassLoader to load the new version. It might be customized to NOT call its parent loader first. It looks awfully simple but I haven't experimented to see how it works. See if that does what you need. Google for "java reload class" and find some other examples, too.