Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

FTP using java

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic