GeeCON Prague 2014*
The moose likes Java in General and the fly likes FTP  using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "FTP  using java" Watch "FTP  using java" New topic
Author

FTP using java

Ramesh
Greenhorn

Joined: Feb 07, 2005
Posts: 3
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.
Julia Reynolds
Ranch Hand

Joined: May 31, 2001
Posts: 123
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
Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
This is my favorite site. Plus the site has a lot of examples:
http://www.jscape.com/inetfactory/index.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FTP using java