Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用jcifs在smb目录中连接时出错_Java_Smb - Fatal编程技术网

Java 使用jcifs在smb目录中连接时出错

Java 使用jcifs在smb目录中连接时出错,java,smb,Java,Smb,如果我尝试 NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("cabanellos.local","deivisson.sedrez", "passs"); String path = "smb://fsct/scanpr$/test.txt";` SmbFile sFile2 = new SmbFile(path, auth); ` 它连接并创建一个文件,但如果我尝试: NtlmPasswordAuthe

如果我尝试

NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("cabanellos.local","deivisson.sedrez", "passs");
String path = "smb://fsct/scanpr$/test.txt";`
SmbFile sFile2 = new SmbFile(path, auth);    `
它连接并创建一个文件,但如果我尝试:

NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("cabanellos.local",  "deivisson.sedrez", "passs");
String path = "smb://fsct/scanpr$/"; 
SmbFile sFile2 = new SmbFile(path, auth);    
SmbFile[] varTeste = dir.listFiles();    
for(int i=0;i<varTeste.length;i++){
    if(varTeste[i].isFile()){                                    
         //site = new URL((Pasta_Financeiro + varTeste[i].getName()).toString()); 
         SmbFile dest = new SmbFile ("file:///"+Pasta_Financeiro + varTeste[i].getName());
         dir.copyTo(dest);
    }
}
NtlmPasswordAuthentication auth=新的NtlmPasswordAuthentication(“cabanellos.local”、“deivisson.sedrez”、“passs”);
字符串路径=”smb://fsct/scanpr$/"; 
SmbFile sFile2=新的SmbFile(路径,身份验证);
SmbFile[]varTeste=dir.listFiles();
对于(int i=0;i您可能应该使用“smb://”+意大利面,而不是我使用的“file://”+意大利面

SmbFile remoteFile=新的SmbFile(“smb://...“”
OutputStream os=newfileoutputstream(“/path/to/local/file”);
InputStream is=remoteFile.getInputStream();
int bufferSize=1024;
byte[]b=新字节[bufferSize];
int noOfBytes=0;
while((noOfBytes=is.read(b))!=-1)
{
os.write(b,0,noOfBytes);
}
os.close();
is.close();

dir.copyTo(dest);

及其作品

我需要帮助