Java reading txt.file - access denied?

别来无恙 提交于 2019-12-05 13:55:54

One random guess is that you may be having multiple instance of your test program running so the file is locked by earlier instance of your program which is still running. You can check open consoles in the eclipse or you can restart eclipse.

java.io.FileNotFoundException: C:\Users\Kristian\Documents (Access is denied)

You are trying to read a directory, not a .txt file.

there could be 2 types of issue.

  1. your path is containing space in folder or file name. you can solve it by using the non-8dot3 file name by using the command dir /p /x in command prompt of that folder path.
  2. you can save the form in your project folder and use relative path ./txt.file. if you have the file under a path say <project folder>/input/txt.file, your relative path will be ./input/txt.file. If this doesn't work try googling the code for file reading and you will find out your mistake.

Could be that you have to change the security settings on your folder. Go into the directory, right click properties, select Security , advances and change permission so that all child dependencies inherit the security changes.

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