How to create a temporary file in Java


Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content
// {...}
String prefix = "my-application-name-";
String suffix = "";
// For files
Path file = Files.createTempFile(prefix, suffix);
// For directories
Path directory = Files.createTempDirectory(prefix);
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content