Connect to FTP server : Ftp « Network Protocol « Java

Connect to FTP server


public class FtpConnectDemo {
  public static void main(String[] args) {
    FTPClient client = new FTPClient();

    boolean login = client.login("admin", "secret");

    if (login) {
      System.out.println("Login success...");
      boolean logout = client.logout();
      if (logout) {
        System.out.println("Logout from FTP server...");
    } else {
      System.out.println("Login fail...");


Related examples in the same category

1.Upload file to FTP server
2.Get list of files from FTP server
3.Download file from FTP server
4.Delete file from FTP server
5.Running the edtFTPj demo
6.Implements a Java FTP client from socket and RFC
7.Graphical Ftp clientGraphical Ftp client
8.Ftp client demonstration
9.Ftp client gets server file size
10.Establish ftp connection
11.Use the FTP Client
12.Use the FTPClient: server file transfer
13.A simple Java tftp client