I\'m facing this strange problem.
I\'m trying to read a file that is located in another machine as a shared resource:
\\\\remote-machine\\dir\\MyFile
I had a similar problem once. I think it has to do with the way java resolves remote files URI's. Try the following and see if it works:
File:////remote-machine/dir/MyFileHere.txt
I used the folowing example to verify the existence of a file in shared folders in my box and worked:
public static void main(String[] args) throws URISyntaxException{
URI uri = new URI(args[0]); //args[0] = File:////remote-machine/dir/MyFileHere.txt
File f = new File(uri);
System.out.print(String.format("File %1$s Exists? %2$s", args[0],f.exists()));
}
Is the shared resource protected by a username and password? And if so, is your application engine running as that user? If your application engine is running as a Windows Service, the Windows service cannot be running as the "Local System Account". This account cannot access the network. You must configure your service to run as a user that has the rights to access the shared drive.
Have you checked the event logs on the server to see if it is being rejected? it could be that the program is running under a different user account than you think.
I'm not familiar with Java, but i know with some programs i've written i've had to allow Network Service to access the resources.
Actually i see that you have now ticked an answer as the correct one. oh and it was the same as my answer :) Cool!
Double check that the file is REALLY Called "MyFileHere.txt" and not "MyFileHere.txt.txt" If you are hiding the extention of the file this is an easy mistake to miss