How to FTP the server ?.

Hi All,I want to ftp the Server using java code. which third party jar is avaiable ?. I want to transfer the binary stream to the server .Waiting for reply.Thanks and regards,Sachin
[216 byte] By [sachin_powalea] at [2007-10-2 5:50:08]
# 1
you could check the link http://forum.java.sun.com/thread.jspa?forumID=31&threadID=549434
intelchipa at 2007-7-16 1:59:31 > top of Java-index,Java Essentials,Java Programming...
# 2

> I want to ftp the Server using java code.

> which third party jar is avaiable ?.

Jakarta's Commons.net package supports the FTP protocol.

See: http://jakarta.apache.org/commons/net/

Here's an example:

import org.apache.commons.net.ftp.*;

public class FTPTest {

public static void main(String[] args) {

String server = "ftp.yourhostname.nl";

String username = "user";

String password = "p@$w";

FTPClient client = new FTPClient();

try {

client.connect(server);

client.login(username, password);

String[] files = client.listNames();

for(int i = 0; i < files.length; i++) {

System.out.println(files[i]);

}

client.disconnect();

}

catch(Exception e) { e.printStackTrace(); }

}

}

prometheuzza at 2007-7-16 1:59:32 > top of Java-index,Java Essentials,Java Programming...