08f8iv2x25 发表于 2016-6-8 06:06:31

ftp实现下载

  import com.enterprisedt.net.ftp.*;
  public class FtpClient {
  static FTPClient ftpClient; 
  public FtpClient(){};
  String remoteAddress="192.168.168.33",userName="cattsoft",password="cattsoft";
  
   public void DownLoad(){ 
          try{  
           FTPClient client = new FTPClient();  
           client.setRemoteHost(remoteAddress);    
           client.connect();         
           client.login(userName,password);  
           client.setType(FTPTransferType.BINARY);  
           client.get("E:\\upload\\index.jsp","/home/cattsoft/jakarta-tomcat-5.0.28/webapps/vip/dkf/index2.jsp");    
           client.quit();  
           System.out.println("下载成功...");
          }catch(Exception e){  
              e.printStackTrace();
              System.out.println("下载失败...");
          }  
  }
  
   public static void main(String[] args){
    FtpClient fc = new FtpClient();
             fc.DownLoad();
   }
}
页: [1]
查看完整版本: ftp实现下载