How to create a temporary file in Java

[CG]BOUGA
1,838 views
undefined

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);
//{...}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content