我正在做一个项目,我需要使用其域、用户名和密码访问 FTP 服务器。我要保存数据
这是我的代码,但它不起作用。我正在使用 Apache Commons FTP 库。你能帮助我吗?谢谢!
FTPClient client = new FTPClient();
try {
client.connect("1.2.3.4");
client.login("USERNAME", "PASSWORD");
String filename = "file1.txt";
FileInputStream fis = null;
fis = new FileInputStream(filename);
client.storeFile(filename, fis);
client.logout();
fis.close();
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.i("tag", "SocketException");
} catch (IOException e) {
// TODO Auto-generated catch block
Log.i("tag", "IOException");
}
错误:
could not find class 'org.apache.commons.net.ftp.FTPClient'