java FTP上传的问题.
FtpClient ftpClient;
// server:服务器名字
// user:用户名
// port:服务器端口
// password:密码
// path:服务器上的路径
public void connectServer(String ip, int port,String user
, String password,String path) {
try {
ftpClient = new FtpClient();
ftpClient.openServer(ip,port);
ftpClient.login(user, password);
if (path.length() != 0) ftpClient.cd(path);
ftpClient.binary();
} catch (IOException ex) {
System.out.println("not login");
System.out.println(ex);
}
}
--------------------以上是连接FTP服务器的代码.
public static void main(String agrs[]) {
updown fu = new updown();
fu.connectServer("xxx.xxx.xxx.xxx",21, "one2010", "steel2010(0)!%","E:\\tomcat\\webapps");
fu.upload();
//fu.download();
fu.closeConnect();
}
--------------------以上是执行代码.
java.io.FileNotFoundException: CWD E:\tomcat\webapps: 550 /E/tomcat/webapps: No such file or directory.
-------------------以上是报错:报ftp服务器路径找不到.
问高人ftpClient.cd(path); 这里面的这个path到底是哪个鬼路径.我们服务器上one2010这个用户的主目录就是e:\tomcat\webapps但还是报错. 其他都没问题.