2012-05-02 43 views
-1

打印目录我在打印的问题,从我使用网络共享的Apache API如何从FTP服务器

FtpClient ftpclient=new FtpClient(); 
ftpclient.connect("garbo.uwasa.fi"); 
System.out.println("this is reply code"+ftpclient.getReplyCode()); 

最后这句话给replycode = 220

String workingdirectory=ftpclient.printWorkingDirectory(); 

在FTP服务器上的目录printdirectory我得到null。可能是什么问题呢?

+0

你确定你的ftp目录不需要某种认证吗? –

+1

下面是如何连接到ftp目录的示例:http://www.kodejava.org/examples/357.html –

+0

嘿aki我解决了这个问题。连接后需要认证。 – itechDroid

回答

1
FtpClient client=new FtpClient(); 
clent.connect("www.ftpserver.com"); 
clent.login("username","password"); 
String workingdirectory=ftp.printWorkingDirectory(); 
this working code so u can access ftp server by using this