...

View Full Version : Perl to Java translation



Fws
12-15-2007, 07:39 PM
What is the java equivalent of the following perl 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!

oesxyl
12-15-2007, 08:52 PM
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

Fws
12-15-2007, 09:35 PM
got it figured out. never mind. Thanks anyway!:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum