使用Apache Commons Net库中的FTPClient类。
这是一个带有示例的代码段:
FTPClient client = new FTPClient();FileInputStream fis = null;try { client.connect("ftp.domain.com"); client.login("admin", "secret"); // // Create an InputStream of the file to be uploaded // String filename = "Touch.dat"; fis = new FileInputStream(filename); // // Store file to server // client.storeFile(filename, fis); client.logout();} catch (IOException e) { e.printStackTrace();} finally { try { if (fis != null) { fis.close(); } client.disconnect(); } catch (IOException e) { e.printStackTrace(); }}摘录自http://www.kodejava.org/examples/356.html



