2013-12-09 3 views
0

내가 서버 디렉토리에 인증 된 디렉토리에서 많은 파일을 이동하려고하지만, "기본이 오류를 스레드에서예외 : 없음 프로토콜 :

예외를 얻고있다 "java.net.MalformedURLException : 프로토콜 없음 : /PGJ/portal/Importador_Documentos_Financeiro/FILES/FINANCEIRO/RF255677.pdf (java.net.URL) (알 수없는 출처) at jcifs.smb.SmbFile (SmbFile.java:446) at 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... 
} 
+2

를 참조하면 심지어 미리 보는나요? http://stackoverflow.com/editing-help#code – SLaks

답변

2

변화 :

SmbFile dest = new SmbFile ("//"+Pasta_Financeiro + varTeste[i].getName()); 

에 : 당신이 당신의 질문을 쓴

SmbFile dest = new SmbFile ("file:///"+Pasta_Financeiro + varTeste[i].getName()); 

wikipedia file URI scheme

+0

위대한, 그 일을, 지금은 단 한 문제가 hehe 인증 – Deivi