1 Reply Latest reply on Mar 3, 2007 3:16 PM by ksmith

    Coldfusion does not release a .JAR file loaded with URLClassLoader

    fiffy
      I have created a java library and packaged it inside a .jar file for disribution. I am then using a java's URLClassLoader to load this jar file on the fly in my ColdFusion code (so that the it can be installed on other machines without the necessity for access to the CF/classpath directories).

      Everything is working fine and I am able to instantiate my classes successfully. My problem is that after I instantiate a class from that jar file, ColdFusion keeps the file open forever. This prevents me from deleting/renaming the file (effectively making any updates to the file require stopping the CF service).

      I tried setting all the variables which hold references to the URLClassLoader and the instantiated classes to empty strings or simulated Null value, and then calling the java.lang.System.gc() garbage collector multiple times... Nothing seems to make ColdFusion let go of the .jar file...

      Does anyone have an idea how I can make CF let go of the .jar file?