Apache Commons IO to get Temporary Directory

Tags: Apache Commons IO

Java Code Examples for using getTempDirectoryPath() and getTempDirectory() methods of org.apache.commons.io.FileUtils class

package simplesolution.dev;

import org.apache.commons.io.FileUtils;
import java.io.File;

public class FileUtilsTempDirectoryExample {

    public static void main(String... args) {
        String tempDirectoryPath = FileUtils.getTempDirectoryPath();
        System.out.println(tempDirectoryPath);

        File tempDirectory = FileUtils.getTempDirectory();
        System.out.println(tempDirectory.getAbsolutePath());
    }
}

Happy Coding 😊

Apache Commons IO to get Readable File Size in KB MB GB TB

Apache Commons IO to get User Directory