Java Delete File deleteFile(String file)

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

Description

delete File

License

Apache License

Declaration

public static void deleteFile(String file) 

Method Source Code


//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.io.File;

public class Main {
    public static void deleteFile(String file) {
        File f = new File(file);
        if (f.exists() && !f.delete()) {
            throw new IllegalStateException("Deletion failed " + file);
        }/* w  ww  .j  a  v  a 2s .c om*/
    }
}

Related

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