0

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?

4

1 に答える 1

0
File directory = new File (System.getProperty("java.io.tmpdir")+"JarClassLoader");

それは次のようになります。

File directory = new File (System.getProperty("java.io.tmpdir"), "JarClassLoader");
于 2012-06-21T23:40:17.990 に答える