标题:java代码中有一处错误,求修复。
只看楼主
yuma
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:银河系
等 级:贵宾
威 望:33
帖 子:1883
专家分:2904
注 册:2009-12-22
结帖率:89.13%
已结贴  问题点数:20 回复次数:2 
java代码中有一处错误,求修复。
javac命令编译的时候,出现一处错误:
JMyFtpClient.java:89: 错误: 解析时已到达文件结尾
    }
     ^
1 个错误

求修复.


程序代码:
import *;

import *;

import java.util.*;


public class JMyFtpClient {
    /*Members*/
private FTPClientDrv m_FtpClient;

    /**
     *
     */
    public JMyFtpClient() {
        super();
        // TODO Auto-generated constructor stub   
        m_FtpClient = null;
    }

    public static void main(String[] args)
        throws ClassNotFoundException, IOException {
        System.out.println("JMyFtpClient Started");

        JMyFtpClient ftp = new JMyFtpClient();

        if (false == ftp.Open("172.16.64.21", 21, "application", "application")) {
            System.out.println("OpenFail");

            return;
        }

        if (false == ftp.DownloadDirectory("/appl/Tmpww", "C:\\TmpWw\\Down")) {
            trace("download Fail");
        }

        /*      if ( false == ftp.UploadDirectory( "C:\\TmpWw" , "/appl/Tmpww") )
                    trace( "Uplaod Directpry Fail" );
                else
                    trace( "Upload Directory Success" );
        */

        /*      for ( int i=0; i < 0; i++ )
                {

                    int nByteDown = ftp.DownloadFile( "appl/3.txt" , "c:\\TmpWw\\Temp\\12" + i + ".txt" );
                    if ( nByteDown <= 0 )
                        System.out.println( "Download File Fail" );
                    else
                        trace( "Download File Success" );


                    int nByteUp = ftp.UploadFile( "C:\\TmpWw\\1.txt" , "appl/Tmp/Tmp2/1" + i + ".txt" );
                    if ( nByteUp <= 0 )
                        System.out.println( "Upload File Fail" );
                    else
                        trace( "Upload File Success" );
                }
        */
        ftp.Close();

        System.out.println("JMyFtpClient Stopped");
    }

    /*Open Connection*/
    public boolean Open(String strServIPAddr, int nServPort,
        String strUserName, String strPassword) {
        try {
            m_FtpClient = new FTPClientDrv(strServIPAddr, nServPort); //Connect to Server

            m_FtpClient.login(strUserName, strPassword);

            m_FtpClient.setType(new FTPTransferType());
        } catch (IOException e) {
            trace("Open Ftp Server Fail, IOException");
            e.printStackTrace();

            return false;
        } catch (FTPException e) {
            trace("Open Ftp server Fail, Ftp Exception");
            e.printStackTrace();

            return false;
        }

        trace("Login FTP Server Ok");

        return true;
    }
搜索更多相关主题的帖子: out 错误 false java ftp 
2020-07-15 10:24
双子座私语
Rank: 3Rank: 3
等 级:论坛游侠
威 望:3
帖 子:19
专家分:141
注 册:2020-5-6
得分:20 
有问题,你把问题日志跟代码贴出来啊,不然没人回你的
2020-07-17 14:51
疯狂的小a
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:39
帖 子:423
专家分:1871
注 册:2018-2-6
得分:0 
以下是引用yuma在2020-7-15 10:24:46的发言:

javac命令编译的时候,出现一处错误:
JMyFtpClient.java:89: 错误: 解析时已到达文件结尾
    }
     ^
1 个错误

求修复.


import *;

import *;

import java.util.*;


public class JMyFtpClient {
    /*Members*/
private FTPClientDrv m_FtpClient;

    /**
     *
     */
    public JMyFtpClient() {
        super();
        // TODO Auto-generated constructor stub   
        m_FtpClient = null;
    }

    public static void main(String[] args)
        throws ClassNotFoundException, IOException {
        System.out.println("JMyFtpClient Started");

        JMyFtpClient ftp = new JMyFtpClient();

        if (false == ftp.Open("172.16.64.21", 21, "application", "application")) {
            System.out.println("OpenFail");

            return;
        }

        if (false == ftp.DownloadDirectory("/appl/Tmpww", "C:\\TmpWw\\Down")) {
            trace("download Fail");
        }

        /*      if ( false == ftp.UploadDirectory( "C:\\TmpWw" , "/appl/Tmpww") )
                    trace( "Uplaod Directpry Fail" );
                else
                    trace( "Upload Directory Success" );
        */

        /*      for ( int i=0; i < 0; i++ )
                {

                    int nByteDown = ftp.DownloadFile( "appl/3.txt" , "c:\\TmpWw\\Temp\\12" + i + ".txt" );
                    if ( nByteDown <= 0 )
                        System.out.println( "Download File Fail" );
                    else
                        trace( "Download File Success" );


                    int nByteUp = ftp.UploadFile( "C:\\TmpWw\\1.txt" , "appl/Tmp/Tmp2/1" + i + ".txt" );
                    if ( nByteUp <= 0 )
                        System.out.println( "Upload File Fail" );
                    else
                        trace( "Upload File Success" );
                }
        */
        ftp.Close();

        System.out.println("JMyFtpClient Stopped");
    }

    /*Open Connection*/
    public boolean Open(String strServIPAddr, int nServPort,
        String strUserName, String strPassword) {
        try {
            m_FtpClient = new FTPClientDrv(strServIPAddr, nServPort); //Connect to Server

            m_FtpClient.login(strUserName, strPassword);

            m_FtpClient.setType(new FTPTransferType());
        } catch (IOException e) {
            trace("Open Ftp Server Fail, IOException");
            e.printStackTrace();

            return false;
        } catch (FTPException e) {
            trace("Open Ftp server Fail, Ftp Exception");
            e.printStackTrace();

            return false;
        }

        trace("Login FTP Server Ok");

        return true;
    }

}

假如人生没有梦想,和咸鱼有什么区别!
2022-08-05 14:24



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-502526-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.271990 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved