I'm trying to get to some text file in my computer but I keep getting this exception although the path is correct and the file is exist. Here is my code:
public static void main(String[] args) throws IOException {
File wordFile = new File("D:\\IDC\\Stuff\\wordList.txt");
RandomAccessFile wordsList = new RandomAccessFile(wordFile, "rw");
System.out.println(wordFile.exists());
}
The error:
Exception in thread "main" java.io.FileNotFoundException: D:\IDC\Stuff\wordList.txt (The filename, directory name, or volume label syntax is incorrect)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at WordChecker.main(WordChecker.java:12)
Can you rename the file? This can help if you copied the file name from another location and it had non-visible characters in it.