|
[SOLVED] Connection to file server
Hello I have a problem with a Java application that I developed, the application must read and write files on a file server, now I'm doing this to read files
byte [] BytesRead = new byte [size];
InputStream stream = new FileInputStream (route + fileName);
stream.read (BytesRead);
stream.close ();
But I get the following error:
java.io.FileNotFoundException: \\server\folder\5\MI143895001.tif (The system detected a possible attempt to compromise security. Please ensure that you can contact the server that you authenticated.)
I understand that the mistake is because I am trying to connect to a server that is not public (server is a windows NAS), has user name and password. The way to connect to the server is as follows
@echo off
net use \\server\folder /user: DOM\user password
Exit
How can i connect to the server from my java application? There is any java class that do this?
Thank you very much
|