I tried searching for relevant posts so as not to waste people's time on here, but the search only turned up stuff from as late as 2001, and it didn't exactly clarify my questions. How does one do simple FTP work in Java? I just need to download a zip file from a server and check that it's up-to-date by parsing the info given on the HTML page and making sure it matches the info on the file I've downloaded. I think I can do that, plus, I know how to parse stuff, and also know about JTidy, as well as the handy code on this page: http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20289893.html#6944368 As for FTPing, I know about http://www.enterprisedt.com/downloads/ftp.html and http://www.geocities.com/SiliconValley/Code/9129/javabean/ftpbean/ and I also got a bit of code from this thread: http://forum.java.sun.com/thread.jsp?thread=217004&forum=54&message=752443 However, that last thread mentioned a package called sun.net.ftp and I assume they meant java.net.ftp since they were talking about doing it in Java, but as far as I can tell, there's no ftp package in java.net, so I'm wondering what's up with that! Should I just be able to use all the classes in the java.net package to do this bit of simple FTPing that I want to do, or do I need to know something else, or should I just use one of the free tools from the other two URLs that I mentioned? I definitely don't want to reinvent the wheel, but if the code is simple enough I would just as soon do it on my own (ftp to a site, get a file, do some checking on it, etc). I'm preferring to do this in Java and then schedule it in a batch file a dozen times per day just b/c I'm used to all the exception/error handling I get in Java.
Hi, Stephen -- I was in your shoes not too long ago, looking for a way to do FTP operations in Java. I do not recommend the sun.net.ftp package. It is not intended for public use and is not documented very well. There are several different ftp tools in Java, but the one that I use is the open source Apache Commons Net package that is really slick. You can download it at this location. Here is a procedure that I wrote that uses this tool to perform ftp file transfers of files in a specified source directory and to rename the source files afterward. As you can see, it is pretty simple. However, in getting it to work I did find that one of the object methods in the package had a bug for which I had to find a work-around. For further info on this, see my thread in this forum.
Hope this helps [ August 04, 2003: Message edited by: Jerry Kreps ] [ August 04, 2003: Message edited by: Jerry Kreps ] [ August 04, 2003: Message edited by: Jerry Kreps ]