java.io.FileNotFoundException: "C:/Users/Joe/Desktop/file.txt" (The filename, directory name, or volume label syntax is incorrect)

Viewed 15367

i have this code :

BufferedReader in = new BufferedReader
(new InputStreamReader(System.in));
System.out.print("Public Key to encrypt with: ");
String publicKeyFilename = in.readLine();
FileInputStream fis = new FileInputStream(publicKeyFilename);

when i enter the destination of the file "C:/Users/Joe/Desktop/file.txt", the result is this error:

java.io.FileNotFoundException: "C:/Users/Joe/Desktop/file.txt" (The filename, directory name, or volume label syntax is incorrect)

but the file exist, so what can i do?

Thank u..

3 Answers
Related