简体   繁体   English

如何在JDK1.7中使用FTPClient?

[英]How to use FTPClient in JDK1.7?

I have already created a project with FTP Client in JDK1.5.我已经在JDK1.5中创建了一个带有FTP客户端的项目。 But i now i want to improve my JDK version to 1.7 .但我现在想将我的 JDK 版本提高到 1.7 While trying to compile those java files using JDK1.7 it shows some error messages in FTP files .在尝试使用JDK1.7编译这些 java 文件时,它在 FTP 文件中显示了一些错误消息 My code is like,我的代码就像,

             **ftpObject.openServer(sServer);
            if (ftpObject.serverIsOpen()) {
                             System.out.println("Connected .." );
                              try {
                                ftpObject.login(sUserId, sPassword);
                                System.out.println(sUserId);
                                System.out.println(sPassword);
                                System.out.println(sSourceFileObj);
                                System.out.println(sDestFileObj);
                                System.out.println("$$$$$$$$$$$$$");
                                System.out.println(sSrcFileName);
                                System.out.println(sDestinationDirectory);
                                ftpObject.ascii();
                                ftpObject.uploadFile(sSourceFileObj, sDestFileObj);
                                } catch (Exception ftpe) {
                                    ftpe.printStackTrace();
                                    return false;
                                }
                                 finally {
                                    ftpObject.closeServer();
                                }
            } else {**

While try to compile i got error message like,在尝试编译时,我收到了错误消息,例如,

      **ftpObject.openServer(sServer);
                                      ^
      symbol:   method openServer(String)
      location: variable ftpObject of type GBMFtpWrapper
      GBMTransactionFile.java:2760: error: cannot find symbol

      if (ftpObject.serverIsOpen()) {
                                         ^
      symbol:   method serverIsOpen()
      location: variable ftpObject of type GBMFtpWrapper**

Should i add any jar files to compile this?我应该添加任何 jar 文件来编译它吗?

I've never heard of a class called GMBFtpWrapper ... and neither has Google.我从来没有听说过一个叫做GMBFtpWrapper的类......谷歌也没有。

I'm guessing that it must be defined in some private library that your application uses.我猜它必须在您的应用程序使用的某个私有库中定义。 Figure out which JAR file it is in, and then add it to the build path.找出它在哪个 JAR 文件中,然后将其添加到构建路径中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM