【发布时间】:2018-05-08 12:00:36
【问题描述】:
我有一个场景,我需要将文件从我的机器发送到某个共享位置。当我可以在我的机器上看到共享位置时(Windows 7)显示为 N:驱动器。
net use 命令的 O/P 找到它的远程,我得到它为 \\smb\ds
我正在编写代码以将字符串写入远程位置的文件,即N:\TESTING_GOING_ON\test.txt 它是这样的,
String user = "abcd:XXXXX";
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(user);
String path = "smb//ds/TESTING_GOING_ON/test.txt";
SmbFile sFile = new SmbFile(path,auth);
try (SmbFileOutputStream sfos = new SmbFileOutputStream(sFile)) {
sfos.write(str.getBytes());
sfos.close();
}
使用jcifs.smb.*
但是,对于路径,我要么没有定义协议,要么连接失败。
所以有人可以让我知道我使用的路径是否正确。 如果不正确怎么办
【问题讨论】: