I am trying to clear the myfolder contents (having some jars) which I wrote in java.io.tmpdir for the applet temporary use. Now, when I am trying to delete the contents(jar's) on void stop() method with below code:
public void stop()
{
File directory = new File (System.getProperty("java.io.tmpdir")+"JarClassLoader");
// Get all files in directory
File[] files = directory.listFiles();
for (File file : files)
{
// Delete each file
if (!file.delete())
{
// Failed to delete file
}
}
}
It's not clearing anything or maybe OS is holding these jar's. Everytime I run an applet, these jar's keep on increasing..is there any way to delete these contents on applet stop?