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
I was reading path from a properties file and didn't mention there was a space in the end. Make sure you don't have one.
i think it always boils to the classpath
. having said that if you run from the same folder where your .class is then change Scanner input = new Scanner(new File("word.txt"));
to Scanner input = new Scanner(new File("./word.txt"));
that should work