During the service hot swap mechanism development of NetServe I run into the problem that jar files getting locked under Windows by the JRE.
After some research I found a simple solution for this problem (maybe it’s a performance issue). Before you instanciate a custom classloader you have to disable caching on the URL.
URL url = new URL("path/to/my.jar"); url.openConnection().setDefaultUseCaches(false);
After that, your jar’s won’t get locked.