G.I.Joe G.I.Joe - 1 year ago 70
MySQL Question

How can i write a propper path for save files in java?

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

and i have made dat folder to accessible for everyone.
Folder right click->propeties->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 i run it. but 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.

Answer Source

Just quess but try:

String path = "\\\\\\PDFINVOICES\\" + pdfFilename;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download