【发布时间】:2019-10-30 07:19:11
【问题描述】:
尝试从 jcifs 移动到 jcifs-ng(最新的 jar jcifs-ng-2.1.2.jar)以将文件复制到远程/从远程复制。 我使用旧 jcifs 的代码:
System.setProperty("jcifs.smb.client.responseTimeout", "10000");
System.setProperty("jcifs.smb.client.soTimeout", "2000");
if (winsIPList.trim().equals("")) {
System.setProperty("jcifs.smb.client.dfs.disabled", "true");
} else {
System.setProperty("jcifs.smb.client.dfs.disabled", "false");
System.setProperty("jcifs.netbios.wins", winsIPList.trim());
System.setProperty("resolveOrder", "DNS");
}
NtlmPasswordAuthentication auth = new
NtlmPasswordAuthentication(filesrvDomainIP, filesrvDomainUser,
filesrvDomainPassword);
smbRemoteFile = new SmbFile("smb:" + remoteFile.replace("\\", "/"), auth);
<here the code to copy file>
在 stackoverflow 中找到了一些示例,但看起来它们很旧。
其中一部分包括 NtlmPasswordAuthentication(context, DomainIP, DomainUser,DomainPassword) 的使用,它在最后一个 jcifs-ng 包中已被弃用。
别人用
SmbFile smbRemoteFile = new SmbFile(remoteFile, someContext)
编译器报告为未定义
有人可以提供一个有效的例子吗?
【问题讨论】: