I need to connect to a shared folder on a remote windows machine through java , where i put my domain authentication (username and password ) in the code , here is my code
File file = new File("\\\\theRemoteIP\\webapps");
File[] files = file.listFiles();
System.out.println("acssed done");
for (int i = 0; i < files.length; i++)
{
String name = files[i].getName();
System.out.println(name);
}
Thanks
If you are accessing open shared folders (i.e. username or password are not known or required),then you can follow the code below :
You should use SmbFile and NtlmPasswordAuthentication from JCIFS. Here is a simple piece of code to show you how to do :