java if directory doesn't exist create it code example
Example 1: java create directory if not exists
String path = ...
File pathAsFile = new File(path);
if (!Files.exists(Paths.get(path))) {
pathAsFile.mkdir();
}
Example 2: java create file in folder
File file = new File("src/resources/run.txt");
file.getParentFile().mkdirs();
FileWriter writer = new FileWriter(file);
writer.append("this is a test");
writer.close();