delete
public boolean delete()Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the directory must be empty in order to be deleted. Returns:
true if and only if the file or directory is successfully deleted; false otherwise 
Throws: 
SecurityException - If a security manager exists and its SecurityManager.checkDelete(java.lang.String) method denies delete access to the filejdk文档中的说明.

解决方案 »

  1.   

    没有,遇到新问题了。这次我是close了文件的啊。我的环境是JBuilder+Tomcat。其实是我在上传文件后(保存到了某个目录),但同时在Tomcat目录也会生成一个(例如:3614dbcbe8b5750a36be2821544e49afzhangy.txt)相同内容的文件。现在我在删除这个文件的时候,死活都删不掉。部分源码如下:
        File upFile = getUpLoadFile("UploadFile");    //写输入文件
        byte fileByte[] = new byte[Integer.parseInt(Long.toString(upFile.length()))];
        try {        FileInputStream ddd = new FileInputStream(upFile);        ddd.read(fileByte);
            ddd.close();        FileOutputStream outf = new FileOutputStream(new File(outFilename));
            outf.write(fileByte);
            outf.close();
        upFile.delete();