Harout Tatarian
Harout Tatarian

Reputation: 431

Java: why using file.exists() is giving a false value even tho the path is complete?

Well, I just started using File and I'm having a problem

My Code:

File file = new File("D:\\File\\TextFile.txt");

System.out.println(file.exists());

Output: false

even tho I've got the file on that directory!

Upvotes: 0

Views: 159

Answers (1)

Harout Tatarian
Harout Tatarian

Reputation: 431

I've found the problem right after I posted. It turned out that my windows is configured to hide extensions so the correct file name would be:

D:\File\TextFile.txt.txt

Upvotes: 4

Related Questions