Cannot make file java.io.IOException: No such file or directory

前端 未结 8 1827
-上瘾入骨i
-上瘾入骨i 2020-12-06 09:11

I am trying to create a file on the filesystem, but I keep getting this exception:

java.io.IOException: No such file or directory

I have an

8条回答
  •  生来不讨喜
    2020-12-06 09:45

    You may want to use Apache Commons IO's FileUtils.openOutputStream(File) method. It has good Exception messages when something went wrong and also creates necessary parent dirs. If everything was right then you directly get your OutputStream - very neat.

    If you just want to touch the file then use FileUtils.touch(File) instead.

提交回复
热议问题