Apache Commons IO to get User Directory
Tags: Apache Commons IO
Java Code Examples for using getUserDirectoryPath() and getUserDirectory() methods of org.apache.commons.io.FileUtils class
package simplesolution.dev;
import org.apache.commons.io.FileUtils;
import java.io.File;
public class FileUtilsUserDirectoryExample {
public static void main(String... args) {
String userDirectoryPath = FileUtils.getUserDirectoryPath();
System.out.println(userDirectoryPath);
File userDirectory = FileUtils.getUserDirectory();
System.out.println(userDirectory.getAbsolutePath());
}
}
Happy Coding 😊