The reason of this issue is explained here: The system already adds ECDSA host key into the “~/.ssh/known_hosts” file, however JSch prefers RSA host key which cannot be found in the “known_hosts”. The fix is to install JCE to enable ECDSA in JSch. The steps comes from here:
Unzip the downloaded “jce_policy-8.zip” file and put the jar files(“local_policy.jar” and “US_export_policy.jar”) into your local JRE security library directory, such as “/usr/lib/jvm/java-8-oracle/jre/lib/security/”.
Now you can try the same code and it should OK now: