Run a command over SSH with JSch
问题 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. /* *