jsch

Run a command over SSH with JSch

北城余情 提交于 2019-11-26 02:29:33
问题 I\'m trying to run a command over SSH with JSch, but JSch has virtually no documentation and the examples I\'ve found are terrible. For example, this one doesn\'t show code for handling the output stream. And, this one uses an ugly hack to know when to stop reading from the output stream. 回答1: The following code example written in Java will allow you to execute any command on a foreign computer through SSH from within a java program. You will need to include the com.jcraft.jsch jar file. /* *

com.jcraft.jsch.JSchException: UnknownHostKey

馋奶兔 提交于 2019-11-26 02:17:38
问题 I\'m trying to use Jsch to establish an SSH connection in Java. My code produces the following exception: com.jcraft.jsch.JSchException: UnknownHostKey: mywebsite.com. RSA key fingerprint is 22:fb:ee:fe:18:cd:aa:9a:9c:78:89:9f:b4:78:75:b4 I cannot find how to verify the host key in the Jsch documentation. I have included my code below. import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; public class ssh { public static void main(String[] arg) { try { JSch jsch = new JSch(); //create

How to resolve Java UnknownHostKey, while using JSch SFTP library?

ⅰ亾dé卋堺 提交于 2019-11-26 02:13:53
问题 I\'m running a java program where I transfer a file from one folder to another, using Java SFTP. The problem I\'m having is that I\'m getting the following error in my Java SFTP (using JSch) : C:\\Oracle\\Middleware\\Oracle_Home\\oracle_common\\jdk\\bin\\javaw.exe -server -classpath C:\\JDeveloper\\mywork\\Java_Hello_World.adf;C:\\JDeveloper\\mywork\\Java_Hello_World\\Client\\classes;C:\\Users\\ADMIN\\Downloads\\jsch-0.1.53.jar -Djavax.net.ssl.trustStore=C:\\Users\\IBM_AD~1\\AppData\\Local\

Certain Unix commands fail with “… not found”, when executed through Java using JSch

[亡魂溺海] 提交于 2019-11-26 00:56:32
问题 I have a piece of code which connects to a Unix server and executes commands. I have been trying with simple commands and they work fine. I am able to login and get the output of the commands. I need to run an Ab-initio graph through Java. I am using the air sandbox run graph command for this. It runs fine, when I login using SSH client and run the command. I am able to run the graph. However, when I try to run the command through Java it gives me a \"air not found\" error. Is there any kind