FTP in JAVA

Discussion in 'Mac Programming' started by larswik, Oct 15, 2006.

  1. larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #1
    This is a little ahead of skill level but I jumped to the end of the book to the Index and was looking for FTP and TELNET but could find nothing that talked about FTP out of the 800 or so pages.

    My original thought was to use the FTP and TELNET from the Terminal since that works to talk to my machines over the net. I did a web search right after looking for JAVA and FTP together and something came up that said Java had an FTP class but unsupported and not documented, I didn't understand that.

    Is that the best way to do it, call on terminal commands using a nice GUI interface(which was the plan from the begining)? Is there more then one way to use FTP commands through JAVA? I'm no where near that point just yet but it would be nice to think about it since I will be there at some point.

    Whats the best way or perfered way?

    -Lars
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    You can read about some of the various pure Java FTP client classes here. You could call out to the command line if you want but you'll spend ages writing code to parse the output...
     
  3. therevolution macrumors 6502

    Joined:
    May 12, 2003
    #3
    I've used the Jakarta Commons Net package for doing FTP before. It works pretty well, and is free. It seems to be much more feature-rich than anything you'll find in the JDK. It looks like it also does Telnet.

    Definitely don't try to do this through the command line, that's just asking for a headache...
     
  4. ddekker macrumors regular

    Joined:
    Sep 23, 2006
    Location:
    Michigan
    #4
    java FTP

    I'm no programmer, I have played with a bit of web development and ran across a java thing on hotscripts for uploading files... search hotscripts.com for file upload or something to do with "slice" it was a java application that slices a file up and sends it... not sure if this will help, but its free and I'm sure you'll learn something..

    Good Luck

    DD
     
  5. larswik thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #5
    Interesting. the original plan was to use the command line but that requiers lots of coding then.

    So the other ones that I could download and are free are those classes? so my program would call upon the FTP class or methods from the class in my own program. Is that how it works or is it a big copy and paste into my code. I'm guessing it is something like the first option.

    Thanks.

    -Lars
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    The ones you download should be FTP classes (either source or compiled) that will expose a defined API that you can use to upload/download files, list the content of remote directories and so on. This is a good idea (especially for the listing of files) as they will take care of all the nasty detail for you. Speaking from experience (I once had the idea that I could write my own FTP client from scratch!) the parsing of the data coming back from a remote server is a pain. There is no standard format for the return of an ls command for instance!
     
  7. larswik thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #7
    Thanks, That gives me an idea of what is up the road in my learning path for what I want to do with Java. So weather I call on a command line or use a 3rd party FTP class I can still do the job. It sounds like the Jakarta Commons Net will do both FTP and TELNET.

    So looking ahead now at my work flow I would need to build a GUI using the swing class and assing buttons and text boxes to use the Jakarta Commons Net FTP / TELNET classes to do what I need.

    That is kind of sum'ing it all up but the end goal.

    -Lars
     

Share This Page