小编Lub*_*lin的帖子

使用最后一个 smb jcifs-ng jar 复制文件

尝试从 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>
Run Code Online (Sandbox Code Playgroud)

在 stackoverflow 中找到了几个例子,但看起来它们很旧。

其中一部分包括 NtlmPasswordAuthentication(context, DomainIP, DomainUser,DomainPassword) 的使用,它在最后一个 jcifs-ng 包中已被弃用。

别人用

SmbFile smbRemoteFile = new SmbFile(remoteFile, someContext)
Run Code Online (Sandbox Code Playgroud)

编译器报告为未定义

有人可以提供一个有效的例子吗?

java smb jcifs

4
推荐指数
1
解决办法
3372
查看次数

标签 统计

java ×1

jcifs ×1

smb ×1