I have develop a program for copy file from local-pc to remote pc (windows). When i mapped a drive it is working fine. But when not mapped or not logged in remote pc file is not coping. Given following exception:
java.io.IOException: The user name or password is incorrect
at java.io.WinNTFileSystem.canonicalize0(Native Method)
at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:414)
at java.io.File.getCanonicalPath(File.java:618)
at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1079)
at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1038)
My code is below: For store user/pass in cmdkey
Runtime.getRuntime().exec("cmdkey /generic:"+ip+" /user:"+userName+" /pass:"+password );
For copy code:
import org.apache.commons.io.FileUtils;
FileUtils.copyFile(src, dest);
Please help me to fix the issue.