How to create a temp file in java without the random number appended to the filename?

First, use the following snippet to get the system’s temp directory:

String tDir = System.getProperty("java.io.tmpdir");

Then use the tDir variable in conjunction with your tempFiles[] array to create each file individually.

Leave a Comment