1

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://172.21.1.91/PDFINVOICES/" + pdfFilename;

and when i run it, it gives an error called

java.io.FileNotFoundException: file:\172.21.1.91\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.

G.I.Joe
  • 77
  • 1
  • 2
  • 10
  • is `PDFINVOICES` anywhere close to `docs`? – Luthando Ntsekwa Aug 23 '16 at 09:07
  • For a Windows-System that would be a UNC-Path. See [File](https://docs.oracle.com/javase/8/docs/api/java/io/File.html). You also may want to build your path using utility classes like `Paths`. – Fildor Aug 23 '16 at 09:51

1 Answers1

1

Just quess but try:

String path = "\\\\172.21.1.91\\PDFINVOICES\\" + pdfFilename;
Evus
  • 400
  • 4
  • 12
  • Nice to hear. It's been 5 years when i last used Java, apparently still in head. Please mark as accepted if it answered your question. – Evus Aug 23 '16 at 10:32