createnewfile creates directory code example
Example: java create file in folder
File file = new File("src/resources/run.txt");
file.getParentFile().mkdirs();
file.createNewFile();
File file = new File("src/resources/run.txt");
file.getParentFile().mkdirs();
file.createNewFile();