1

I need to search for file in the network and check if the file exist or not, I use this code:

File listOfFiles = new File ("\\\\server\\share\\TEST\\file.xml");
if (listOfFiles.exists() && listOfFiles.isFile()){
   // ...
}

but it seems that the user didn't have permission to access the network driver. I need to send the user name and password for the user who have rights to this driver, but I don't know how.

CupawnTae
  • 14,192
  • 3
  • 29
  • 60
  • 2
    This might help http://stackoverflow.com/a/10600116/1469259 – CupawnTae Nov 28 '15 at 12:57
  • related http://superuser.com/questions/344775/passing-unc-username-and-password-within-a-unc-path - you can instead mount the share to a drive letter and then access it like a regular file. Credentials are then handled by the mount – zapl Nov 28 '15 at 13:05
  • the problem is I can't import NtlmPasswordAuthentication, as I said I use java in Eclipse. and share a drive conn't help because the issue is that the user who run the application is a local user and didn't have a permission to access the other driver in the network – KaitoArchives Nov 29 '15 at 08:12

0 Answers0