Serban Ciofliceanu
Serban Ciofliceanu

Reputation: 77

Why is this file path wrong?

I am working on an app and I have to use a certificate and this is the code :

File f = new File("‪‪D:\\john.doe.pfx");

When I run the app it gives me this error :

java.io.FileNotFoundException: ‪‪D:\john.doe.pfx (The filename, directory 
name, or volume label syntax is incorrect)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at testoauth.TestOAUTH.main(TestOAUTH.java:58)

The certificate was in a folder called "proiect oauth" and i got it out and put it directly in D:

I would like to use the file and not give error

Upvotes: 4

Views: 332

Answers (1)

khelwood
khelwood

Reputation: 59211

The string you are using has invisible unicode characters \u202a at the start.

It is as if you had:

new File("\u202a\u202aD:\\john.doe.pfx");

which is not the correct path.

Retype the line and omit the invisible characters at the start.

Upvotes: 13

Related Questions