Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is this file path wrong?

Tags:

java

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

like image 436
Serban Ciofliceanu Avatar asked Dec 10 '22 03:12

Serban Ciofliceanu


1 Answers

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.

like image 138
khelwood Avatar answered Mar 07 '23 12:03

khelwood