String name="d:/temp/tmpfile";
File file = new File(name);
file.delete();

解决方案 »

  1.   

    32.文件操作
    //file delete,new,renamepublic class FileOperator {    public FileOperator() {
        }    public static void main(String[] args) {
             FileOperator fileOperator1 = new FileOperator();
             CmyFileOperate fileoperate=new CmyFileOperate("okdeleteme.txt");//"F:\\my_bag\\JBuilder6.0\\FileOperate_test\\deleteme.txt"
    //         fileoperate.rename("okdeleteme.txt");
             fileoperate.delete() ;
        }
    }class CmyFileOperate {
          String m_filemane=null;//文件名
          File m_fullpath=null;//全路径      CmyFileOperate(String fullpath){
                String str=fullpath;
                if((str.indexOf("\\")==-1)&&(str.indexOf("/")==-1)){//文件名
                      String s=System.getProperty("user.dir") ;
                      this.m_fullpath=new File(s+"\\"+fullpath);
                      this.m_filemane=fullpath;
                }
                else{//全路径
                      this.m_fullpath=new File(str);//当前目录F:\my_bag\JBuilder6.0\FileOperate_test
                      this.m_filemane =this.m_fullpath .getName() ;
                }
          }      public void rename(String filename){
    //            File file=new File(this.m_fullpath);
                this.m_fullpath.renameTo(new File(m_fullpath.getParent() ,filename)) ;
          }      public boolean delete(){
                if (this.m_fullpath .exists()){
                      boolean deleteresult=this.m_fullpath.delete();
                      return deleteresult;
                }
                System.out.println("file not found .") ;
                return false;
          }
    }
      

  2.   


    http://www.csdn.net/expert/topic/795/795315.xml?temp=.2226221
    数据库同步的巨难问题,谁解决了100分奉送,我还管他叫阿爹!!