Java File Path Delete deleteFile(String filePath)

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

Description

delete File

License

Open Source License

Declaration

public static void deleteFile(String filePath) 

Method Source Code


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

import java.io.File;

public class Main {
    public static void deleteFile(String filePath) {
        if (null == filePath || "".equals(filePath.trim())) {
            throw new IllegalArgumentException("File Path cannot be Null/Empty");
        }/*ww  w  .ja v a  2  s .  co m*/
        deleteFile(new File(filePath));
    }

    public static void deleteFile(File file) {
        if (null == file || !file.exists()) {
            throw new IllegalArgumentException(file + " does not exist");
        }
        file.delete();
    }
}

Related

  1. deleteFile(String filePath)
  2. deleteFile(String filePath)
  3. deleteFile(String filePath)
  4. deleteFile(String filePath)
  5. deleteFile(String filePath)
  6. deleteFile(String filePath)
  7. deleteFile(String filePath)
  8. deleteFile(String filePath)
  9. deleteFile(String filePathAndName)