Apache FTPServer Project > Index > Documentation > Embed

How can I embed the FTP server in my application?

The following script shows how the FTP server can be embedded.

// get the configuration object
Configuration config = getConfiguration();

// create servce context
FtpServerContext ftpConfig = new ConfigurableFtpServerContext(config);

// create the server object and start it
FtpServer server = new FtpServer(ftpConfig);
server.start();

If you want to stop the FTP server:

server.stop();