FTP usage in Java

Discussions

Web tier: servlets, JSP, Web frameworks: FTP usage in Java

  1. FTP usage in Java (3 messages)

    My name is Ravi Pal.
    I was wondering how to use FTP in java code.
    Will some body help me.
    Thx.

    Threaded Messages (3)

  2. FTP usage in Java[ Go to top ]

    hi,
       There are some ftp classes in the sun packages of the java 2 se. You will have to look in sun.net.ftp package inside the rt.jar file in your jdk1.2 distribution. I have found these classes to be useful but be aware they are sun classes and therefore subject to change without notice or not be included at all in subsequent releases of the jdk. There are no api docs for these classes so you will have to find some other way to figure out how they work ;-)
  3. FTP usage in Java[ Go to top ]

    A quick and dirty way to use FTP would be to create 2 files on the fly. One that has the ftp commands, and another that executes those commands.

    file1.txt
    *******************************
    open some.ip.address
    anonymous
    binary
    send some.file
    *******************************

    file2.bat
    *******************************
    ftp -s:file1.txt
    *******************************

    Use Runtime.getRunTim().exec(cmd)

    cmd would be a String array such as...

    String[] cmd = new String[3];
    cmd[0] = "command.com" ;
    cmd[1] = "/c" ;
    cmd[2] = "file2.bat";



  4. FTP usage in Java[ Go to top ]

    Look for the oroinc network classes, they are the best FTP (and many other protocols) classes I have seen for Java.

    Also, check out alphaworks.ibm.com and look for their FTP bean, which is also very good.

    Chz

    Tony