I was looking at all the possibilites of transferring file from one system(source system(s)) to other(target system) through pure java code. Socket programming is one of the ways suggested by my friend. But it seems to be a tedious job... opening connection, sending request, closing connection. And the base line truth is that I don't know how to do these all :).
I was searching in Java Library for file transfer and I saw Java FTP client Library support. We can upload or download files from remote computer running an FTP server simply with some method calls.
Look at this code:
FTPClient objectClient = new FTPClient();
objectClient.connect("SystemName","username","password");
objectClient.download("D:\\Myfile\\","RequiredFile.txt");
objectClient.disconnect();
FTPClient Package was supported by Sun, its never be a part of jdk package and I guess it was deprecated now :((
Any simple idea to do file transfer ?
No comments:
Post a Comment