//大家帮看看这个文件为何删除不掉,是不是有什么东西没有关掉?
//谢谢。package untitled1;import java.io.FileInputStream;
import java.io.File;
import java.nio.channels.FileChannel;
import java.nio.MappedByteBuffer;public class TestToDel {
  public TestToDel() {
  }  public static void main(String[] args) {
    TestToDel testToDel1 = new TestToDel();
    int STEP = 256;
    FileInputStream fin = null;
    File swapFile = new File("C:\\test.dat");
    FileChannel fcin = null;
    MappedByteBuffer reader = null;
    try {
      if (reader == null) {
        fin = new FileInputStream(swapFile);
        fcin = fin.getChannel();
        reader = fcin.map(FileChannel.MapMode.READ_ONLY, 0, fcin.size());
      }
      fcin.close();
      fin.close();      swapFile.delete();
    }
    catch (Exception ex) {
      ex.printStackTrace();
      return;
    }
  }
}