title: JSch sftp upload/download progress
body: <p>I am new to JSch and java. I managed to get some codes and understand it somehow, but i am stuck on one point. The following code downloads file from SSH server, but i am in need of the progress meter that shows percentage of file copied. HOw can i do it. I will be greatly appreciate your help.</p>
  
  <pre><code>import com.jcraft.jsch.ChannelSftp;
  import com.jcraft.jsch.JSch;
  import com.jcraft.jsch.Session;
  import com.jcraft.jsch.SftpProgressMonitor; 
  public class SFTPExample {
      public static void main(String args[]) throws Exception {
          String user = "root";
          String password = "password";
          String host = "192.168.0.5";
          int port = 22;
          String knownHostsFilename = "/home/world/.ssh/known_hosts";        
          String sourcePath = "/media/nfs/genotype.txt";
          String destPath = "genotype.txt";        
          JSch jsch = new JSch();
          jsch.setKnownHosts(knownHostsFilename);
          Session session = jsch.getSession(user, host, port);
          session.setPassword(password);
          session.connect(); 
          ChannelSftp sftpChannel = (ChannelSftp) session.openChannel("sftp");
          sftpChannel.connect();
  
          System.out.println("Downloading test file");
          sftpChannel.get(sourcePath, destPath);            
  
          sftpChannel.exit();
          session.disconnect();
      }
  }
  </code></pre>