Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Fws
    Fws is offline
    New Coder
    Join Date
    Sep 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Perl to Java translation

    What is the java equivalent of the following perl code?
    Code:
    #!/usr/bin/perl
     
    use strict;
    use warnings;
    use Net::FTP;
     
    my $file = shift;
    my $server = 'domain.com'; (edited out)
    my $username = 'username'; (edited out)
    my $password = 'password'; (edited out)
     
    my $remote_dir = 'domain.com'; (edited out)
     
    my $ftp = Net::FTP->new($server) or die "can't connect to $server: $@";
    $ftp->login($username, $password) or die "can't login ", $ftp->message;
    $ftp->cwd($remote_dir) or die "can't cd to $remote_dir ", $ftp->message;
    $ftp->put($file) or die "can't transfer $file", $ftp->message;
    $ftp->quit;
    exit 1;
    Thank you!

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    This is a java binding for curl, another ftp client, with many future.

    http://curl.haxx.se/libcurl/java/

    Still you can deal with java programming, I think it's easy to use this
    in your application.

    best regards

  • #3
    Fws
    Fws is offline
    New Coder
    Join Date
    Sep 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    got it figured out. never mind. Thanks anyway!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •