我现在知道远程linux主机名test001.test.com ,和文件在远程主机上的路径 /home/log/log.txt , 我现在也有登陆主机的用户名密码,如何用java获取该文件的内容呢?

解决方案 »

  1.   

    如果在linux上开启ftp或samba服务的话 ,就可以读了
    没有协议支持的话,好像是不可能的。
      

  2.   

       
               String smbMachine="smb://username:[email protected]/log.txt";  
               String localPath="D:\\temp";     
               File file=readFromSmb(smbMachine,localPath);     
      
        FtpClient ftpClient=new FtpClient();
      ftpClient.openServer(server);
      ftpClient.login(user, password);
      if (path.length()!=0) ftpClient.cd(path);
      ftpClient.binary();
      TelnetInputStream is=ftpClient.get(filename);