Hi,
how to download a file from remote system using FTP in java ?
I wrote a code in java using URL class. But it didn't work.
try {
System.out.println ("FTP prg");
String FTP_Address = "ftp://bruvo:bruvo123@192.114.1.93/home/bruvo/test.txt;type=i";
URL url = new URL(FTP_Address);
URLConnection con = url.openConnection();
BufferedInputStream in = new BufferedInputStream(con.getInputStream());
FileOutputStream out = new FileOutputStream("/home/sjayaram/Store/test.txt");
int i = 0;
byte[] bytesIn = new byte[1024];
while ((i = in.read(bytesIn)) >= 0)
{
out.write(bytesIn, 0, i);
}
out.close();
}
In " ftp://bruvo:bruvo123@192.114.1.93/home/bruvo/test.txt;type=i " string,
bruvo is user name, bruvo123 is password and 192.114.1.93 is the remote system IP.
But, it doesn't works.
Any one have idea?.
Thank you.