请问如何用java 程序启动Apache-ftpserver 功能
我想利用java程序启动Apache-ftpserver 代码如下
FtpServerFactory serverFactory = new FtpServerFactory(); //监听 ListenerFactory factory = new ListenerFactory(); factory.setPort(2121); serverFactory.addListener("default", factory.createListener()); PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory(); userManagerFactory.setFile(new File("D:/users.properties")); /**使用自己的加密类,因为apache ftp server 使用的是md5 也就是logon之前需把密码加密后才能logon */ // userManagerFactory.setPasswordEncryptor(new LocalPassword()); serverFactory.setUserManager(userManagerFactory.createUserManager()); //创建服务并启动 FtpServer server = serverFactory.createServer(); try { server.start(); } catch (FtpException e) { e.printStackTrace(); }