1

I need to load classes from jars, to do it I'm using:

cls = Class.forName(className, false, classLoader);

At the end, I want to delete these jars, but it seems that this is not possible because ClassLoader does not release the jars. So I used:

classLoader.release();

System.gc();

But unfortunately this does not solve the problem...

khouloud
  • 417
  • 4
  • 17

1 Answers1

1

According to the JLS, classes (and therefore JAR-files) cannot be unloaded explicitly.

It might be possible to achieve something similar with some trickery as described here, but it depends on the actual implementation of the JVM and is therefore nothing you should build on.

Quaffel
  • 1,463
  • 9
  • 19