FTPclient找不到方法

时间:2017-03-04 14:02:42

标签: java class ftp-client

由于某种原因,他没有看到类方法retrieveFile

  public static boolean downloadFile(String Filename, String patch, FTPclient client) throws IOException{
        try {

            String remoteFile1 = Filename;
            File downloadFile1=new File("E:/Dropbox/"+remoteFile1);
            OutputStream outputStream1 = new BufferedOutputStream (new FileOutputStream (downloadFile1));
            boolean success = client.retrieveFile(remoteFile1, outputStream1);
            System.out.println(success);
            outputStream1.close();
            if (success == true) {
               return true;
            }
            else System.out.println("False");

        } catch (SocketException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
return false;
    }

但如果代码放在" main"方法同一类,方法可见。

代码:

   boolean success = client.retrieveFile(remoteFile1, outputStream1);

错误消息(功能" retrieveFile"未找到):

Error:(99, 37) java: cannot find symbol

symbol:方法retrieveFile(java.lang.String,java.io.OutputStream)   location:FTPclient类型的变量客户端

0 个答案:

没有答案