Java 8 Create Parent Folder and Writing/Reading File
Java 8 Create Folder and Writing/Reading File
public class CreateFolderAndWrite {
public static void main(String[] args) {
try {
Path path = Paths.get("logs/error.log");
Files.createDirectories(path.getParent());
Files.write(path, "Log log".getBytes());
System.out.println(Files.readAllLines(path));
} catch (IOException e) {
e.printStackTrace();
}
}
}
Created 6 years ago by Ahmet Faruk Bişkinler
Last Updated 6 years ago by Ahmet Faruk Bişkinler