G.I.Joe G.I.Joe - 7 months ago 41
Java Question

How can i write a proper path to save files in java?

I have made an application to save customer invoices in shared folder
so first in my desktop-pc I have created a folder and named as "PDFINVOICES" in D: drive.

and I have made that folder to accessible for everyone.
Folder right click->properties->sharing->advance sharing & also in security tab as well

and I have changed my application path as

//Original path

String path = "docs/" + pdfFilename;

//Changed path

String path = "file://" + pdfFilename;

and when i run it, it gives an error

java.io.FileNotFoundException: file:\\PDFINVOICES\222016-08-23.pdf (The filename, directory name, or volume label syntax is incorrect)

Previously it worked nicely with original path.
After i changed it, it doesn't work.


Just quess but try:

String path = "\\\\\\PDFINVOICES\\" + pdfFilename;