Java Temporary Files and Directories
Jump to navigation
Jump to search
Internal
TODO
Default Temporary-File Directory
The JVM obtains the default temp directory from the "java.io.tmpdir" property.
Temporary Directory
Java can create a temporary directory in a given directory or in the default temporary-file directory:
java.nio.file.Files.createTempDirectory(Path dir, String prefix, FileAttribute<?>... attrs);
java.nio.file.Files.createTempDirectory(String prefix, FileAttribute<?>... attrs);
On a Mac,
Files.createTempDirectory("test");
creates /var/folders/t3/mmn20npx7fs31lwlp2s4_6wm0000gq/T/test5357804169564764079.
The directory is not automatically deleted upon the VM exit.