Java Delete File deleteFile(final File file)

Here you can find the source of deleteFile(final File file)

Description

Opens a thread to delete the specified file.

License

Open Source License

Parameter

Parameter Description
file - the file to be deleted

Declaration

static void deleteFile(final File file) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    /**/*w ww . j a va2 s .c o m*/
     * Opens a thread to delete the specified file.
     * 
     * @param file
     *            - the file to be deleted
     */
    static void deleteFile(final File file) {
        new Thread(new Runnable() {

            @Override
            public void run() {
                while (file.exists()) {
                    file.delete();
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }
}

Related

  1. deleteFile(File source)
  2. deleteFile(final File f, final int attempts, final long sleepTime)
  3. deleteFile(final File file)
  4. deleteFile(final File file)
  5. deleteFile(final File file)
  6. deleteFile(final String dirname)
  7. deleteFile(Object fileObj)
  8. deleteFile(String archiveFilename)
  9. deleteFile(String dest)