java.io.FileNotFoundException: the system cannot find the file specified

前端 未结 8 1445
Happy的楠姐
Happy的楠姐 2020-11-22 15:27

I have a file named \"word.txt\".

It is in the same directory as my java file.

But when I try to access it in the following code th

8条回答
  •  抹茶落季
    2020-11-22 16:02

    I have the same problem, but you know why? because I didn't put .txt in the end of my File and so it was File not a textFile, you shoud do just two things:

    1. Put your Text File in the Root Directory (e.x if you have a project called HelloWorld, just right-click on the HelloWorld file in the package Directory and create File
    2. Save as that File with any name that you want but with a .txt in the end of that I guess your problem is solved, but I write it to other peoples know that. Thanks.

提交回复
热议问题