Here you can find the source of delFile(String filePathAndName)
public static void delFile(String filePathAndName)
//package com.java2s; /*/* w w w .ja v a 2 s . c om*/ * Copyright (C) 2001-2004 Gaudenz Alder * * 6/01/2006: I, Raphpael Valyi, changed back the header of this file to LGPL * because nobody changed the file significantly since the last * 3.0 version of GPGraphpad that was LGPL. By significantly, I mean: * - less than 3 instructions changes could honnestly have been done from an old fork, * - license or copyright changes in the header don't count * - automaticaly updating imports don't count, * - updating systematically 2 instructions to a library specification update don't count. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ public class Main { public static void delFile(String filePathAndName) { try { String filePath = filePathAndName; filePath = filePath.toString(); java.io.File myDelFile = new java.io.File(filePath); myDelFile.delete(); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }