java.io.IOException: Permission denied in Java

你离开我真会死。 提交于 2019-12-06 04:32:05

To create a File into the same folder in your project, your path has to be relative.

The path that you are giving is absolute, because it is starting from /. For your path to be relative, remove / from the path and try this :

File file = new File("textfile.txt");
Harsh Parikh

What you can do is to create a variable string, store the file name, and pass that string into the File file=new File(string);

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!