Java Files.write NoSuchFileException

Solution 1:

You should be able to create a file, but you can't create a directory. You may need to check the directory C:\Users\Administrator\Desktop\work exists first.

You can do

Path parentDir = project.getFilePath().getParent();
if (!Files.exists(parentDir))
    Files.createDirectories(parentDir);

Solution 2:

The file will be written if default OpenOptions parameter is used. If you specify CREATE, default parameters will not be used, but it is used just CREATE. Try to add WRITE in addition to CREATE, or just leave that parameter empty