How can I make FTP connections through a proxy server?

Tim Rohaly

Java uses three system properties to designate an FTP proxy: ftp.useProxy, ftp.proxyHost and ftp.proxyPort. For applets, these are automatically set to use the browser's settings. However, in an application you need to set them yourself:

Properties props = System.getProperties();
props.put("ftp.useProxy", "true");
props.put("ftp.proxyHost", "proxyhostname");
props.put("ftp.proxyPort", "proxyhostport");

See also How can I download files from a URL using FTP?.