User 1034 User 1034 - 11 months ago 72
Java Question

Create a New folder using Java Program on Windows and Linux machines

How can I create a Folder using Java code on both Windows and Linux machines?

Answer Source
new File("/path/to/folder").mkdir();

If you want to created nested folders (i.e. more than one folder on the path may be missing), then use mkdirs(). See

Note that forward slashes would normally not work on windows, but Java normalizes the path and translates forward to backward slashes.