-1
  package util;
  import com.jcraft.jsch.Channel;
  import com.jcraft.jsch.ChannelSftp;
  import com.jcraft.jsch.JSch;
  import com.jcraft.jsch.JSchException;
  import com.jcraft.jsch.Session;
  import com.jcraft.jsch.SftpException;


      public class JschTransferlinuxWindows 
   {
   
   public static void main(String args[])
  {
   String hostname = "10.10.139.79";
  String username = "root";
  String password = "*******";
  String copyTo;
  String copyFrom = "/mnt/fs0/Diff/*";
  copyTo = "C:\\Users\\akshay_gawand\\Desktop\\8.3\\Transfer";
  JSch jsch = new JSch();
  Session session = null;
  System.out.println("Trying to connect.....");
   try {
 session = jsch.getSession(username, hostname, 22);
    session.setConfig("StrictHostKeyChecking", "no");
  session.setPassword(password);
   session.connect();
   Channel channel = session.openChannel("sftp");
  channel.connect();
 ChannelSftp sftpChannel = (ChannelSftp) channel;
  sftpChannel.get(copyFrom, copyTo);
  sftpChannel.exit();
   session.disconnect();
  } catch (JSchException e) {
   e.printStackTrace();
    } catch (SftpException e) {
  e.printStackTrace();
     }
   System.out.println("Done !!");
     }
  }

I am getting below error after executing above code:

Trying to connect.....
com.jcraft.jsch.JSchException: Algorithm negotiation fail
Done !!
at com.jcraft.jsch.Session.receive_kexinit(Session.java:520)
at com.jcraft.jsch.Session.connect(Session.java:286)
at com.jcraft.jsch.Session.connect(Session.java:150)
at util.JschTransferlinuxWindows.main(JschTransferlinuxWindows.java:29)
3
  • How does the question relates to Selenium? Commented Nov 12, 2021 at 18:27
  • 1
    In order to identify the root cause You need to give us the output of jsch logger. Commented Nov 12, 2021 at 18:34
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Nov 15, 2021 at 2:15

1 Answer 1

0

I have updated jsch libraries to the latest and It has been resolved.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.