import org.apache.commons.net.ftp.FTPClient; import java.io.IOException; public class FTPLogin { /** * Comment se logger à un serveur FTP **/ public static void main(String[] args) throws Exception { FTPClient client_ftp = new FTPClient(); client_ftp.connect("ftp.exemple.com"); // Tenter une connexion avec le nom et le mot de passe boolean login = client_ftp.login("admin", "******"); // Vérifier si la connexion a marchée if (login) { System.out.println("Vous êtes connecté"); } else { System.out.println("La Connexion a échouée"); } client_ftp.disconnect(); } }