Java Path delete on JVM exit

Description

Java Path delete on JVM exit

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

public class Main {
  public static void main(String[] args) throws IOException {
    Path tempFile = Files.createTempFile("TempFile", ".txt");

    tempFile.toFile().deleteOnExit();/*from  ww  w  . ja  va 2  s  . c o m*/
  }
}



PreviousNext

Related