我嘗試了很多文件,從認證目錄移動到服務器的目錄,但我得到這個錯誤在線程異常線程「main」 java.net.MalformedURLException:無協議:
異常「主「java.net.MalformedURLException:no protocol:/PGJ/portal/Importador_Documentos_Financeiro/FILES/FINANCEIRO/RF255677.pdf at java.net.URL。(Unknown Source) at jcifs.smb.SmbFile。(SmbFile.java:446 ) 在importador_documentos.Main.main(Main.java:82)
我嘗試了很多東西,但沒有已經解決了這個問題,請有人可以幫助我嗎?
public class Main {
public static String Pasta_Financeiro = System.getProperty("user.dir") +
File.separatorChar + "FILES" + File.separatorChar +
"FINANCEIRO" + File.separatorChar;
public static void main(String[] args) throws ClassNotFoundException,
SQLException,
FileNotFoundException,
IOException,
AuthenticationException
{
try{
jcifs.Config.registerSmbURLHandler();
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("cabanellos.local", "deivisson.sedrez", "password");
String path = "smb://fsct/scanpr$/";
SmbFile sFile = new SmbFile(path.toString(), auth);
SmbFile[] varTeste = sFile.listFiles();
SmbFile dir = new SmbFile(path.toString(), auth);
System.out.println(dir.getDate());
URL site;
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 ("//"+Pasta_Financeiro + varTeste[i].getName());
dir.copyTo(dest);
}
}
//rest of content...
}
你連看預覽爲你寫你的問題? http://stackoverflow.com/editing-help#code – SLaks