• Post Reply Bookmark Topic Watch Topic
  • New Topic

FTP using java  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Does java supports using FTP?

Actually I am trying to get data from different Windows NT machines to UNIX box using java, Please provide me with some idea on this.

Thanks in advance,

Ramesh.
 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramesh,

We use the apache commons net package. http://jakarta.apache.org/commons/net/

The code is simple to implement, here is a sample:

// Connect and logon to FTP Server
FTPClient ftp = new FTPClient();
ftp.connect(server);
ftp.login(username, password);

// Change to the directory
ftp.changeWorkingDirectory(folder);

FileInputStream src2 = new FileInputStream(outFile);
ftp.storeFile(filename,src2 );
src2.close();
ftp.logout();
ftp.disconnect();

Hope this helps,

Julia
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my favorite site. Plus the site has a lot of examples:
http://www.jscape.com/inetfactory/index.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!