Click here to Skip to main content
11,494,785 members (62,535 online)
Rate this: bad
good
Please Sign up or sign in to vote.
Hi there I need Urgent help please I am trying to connect to a FTP server but it bombs out at
mFTPClient = new FTPClient();

with this error when I mouse over FTPClient();
Quote:
Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.


I Have downloaded the library file for
import org.apache.commons.net.ftp.*;
From http://commons.apache.org/net/download_net.cgi[^]

The full connection method is

public boolean ftpConnect(String host, String username,String password, int port){
 
                try {
                 mFTPClient = new FTPClient();
                 // connecting to the host
                 mFTPClient.connect(host, port);
 
                 // now check the reply code, if positive mean connection success
                 if (FTPReply.isPositiveCompletion(mFTPClient.getReplyCode())) {
                     // login using username & password
                     boolean status = mFTPClient.login(username, password);
 
                     /* Set File Transfer Mode
                      *
                      * To avoid corruption issue you must specified a correct
                      * transfer mode, such as ASCII_FILE_TYPE, BINARY_FILE_TYPE,
                      * EBCDIC_FILE_TYPE .etc. Here, I use BINARY_FILE_TYPE
                      * for transferring text, image, and compressed files.
                      */
                     mFTPClient.setFileType(FTP.BINARY_FILE_TYPE);
                     mFTPClient.enterLocalPassiveMode();
                     Toast.makeText(getBaseContext(),"Connected!!",Toast.LENGTH_LONG).show();
                     return status;
                 }
             } catch(Exception e) {
                 Toast.makeText(getBaseContext(),"failed "+e+"/r/n Could not connect to"+host,Toast.LENGTH_LONG).show();
             }
 
             return false;
            }

please as I am still new to android and java development ANY help would be appreciated

The toast's are just for device test that I am able to see where it succeeds and where it fails

Kind Regards
A.J Bosch
Posted 23-Nov-12 2:00am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

PLease follow that link which will guide you to full example about FTP in android :
FTP in Android

Regards...
  Permalink  
Comments
A.J Bosch at 23-Nov-12 8:08am
   
don't know if you noted that I have the exact same connection method from that site I have downloaded the library file and added it to my project yet it needs a Javadoc that I know nothing of and also cant find it as a file only view it on the site in my question
Tamer Hatoum at 23-Nov-12 8:20am
   
this is depending how you are adding your dependencies
Go to Project=>Properties and select "Java Build Path"
Select "Order and Export" tab
Move "android 2.x.x" and "Android Dependencies" to the top of the list
Tamer Hatoum at 23-Nov-12 8:21am
   
also follow that link will guide you how to add the file : http://lavalatwork.blogspot.com/2010/09/using-apache-commons-ftp-library-in.html
A.J Bosch at 27-Nov-12 7:27am
   
thanx a lot there was a problem with my setup of the library file
1st right click on project=> Import=> expand general=> select archive File=> browse for your library file in my case commons-net-3.1.jar then click finish

2nd right click on project=> Properties=> select libraries tab=> Add external JARs=> then browse for the same file in my case commons-net-3.1.jar => click open=> and then ok

"javadoc.jar missing" error is no more

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 708
1 Sergey Alexandrovich Kryukov 369
2 CHill60 350
3 Sascha Lefèvre 255
4 Nakul Chaudhari 236
0 Sergey Alexandrovich Kryukov 10,277
1 OriginalGriff 8,805
2 Sascha Lefèvre 3,704
3 Maciej Los 3,392
4 Richard Deeming 2,500


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 23 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100