Servlet running in a unix machine wants to access a file in
windows machine.can anyone suggest how to incorporate ftp command in servlet.
Thanks in advance
If the file(on the NT side) can be served up by a web-server, then just have the servlet open a socket or URLConnection and get it that way.
If you really need to access it via FTP, then you have a couple of options. The easiest of which is to just create two batch files on the fly. One with the ftp comands, and one that executes the commands like below...
PrintWriter fout = new PrintWriter(new FileOutputStream("ftp.in"));
fout.println("open " + args);
fout.println("send " + args);
fout = new PrintWriter(new FileOutputStream("run.bat"));
String cmd = new String;
cmd = "command.com" ;
cmd = "/c" ;
cmd = "run.bat";
Hope this helps