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 Thu, May 31, 2018 8:41 AM by Ahmet Faruk Bişkinler
Last Updated Tue, Jun 5, 2018 7:47 AM by Ahmet Faruk Bişkinler