Java Delete File deleteFile(String file)

Here you can find the source of deleteFile(String file)

Description

delete File

License

GNU General Public License

Parameter

Parameter Description
file file to be deleted

Exception

Parameter Description
IOException if an IO Exception occurs

Declaration

public static void deleteFile(String file) throws IOException 

Method Source Code

//package com.java2s;
/* DigiDoc4J library/* ww w .  jav  a  2 s  .  com*/
*
* This software is released under either the GNU Library General Public
* License (see LICENSE.LGPL).
*
* Note that the only valid version of the LGPL license as far as this
* project is concerned is the original GNU Library General Public License
* Version 2.1, February 1999
*/

import java.io.*;

public class Main {
    /**
     * @param file file to be deleted
     * @throws IOException if an IO Exception occurs
     */
    public static void deleteFile(String file) throws IOException {
        File f = new File(file);
        if (f.exists())
            f.delete();
    }
}

Related

  1. deleteFile(final String dirname)
  2. deleteFile(Object fileObj)
  3. deleteFile(String archiveFilename)
  4. deleteFile(String dest)
  5. deleteFile(String f)
  6. deleteFile(String file)
  7. deleteFile(String file)
  8. deleteFile(String file)
  9. deleteFile(String filename)