Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 Java 中运行 SSH,但我还没有弄清楚如何运行包含命令和文件的 SSH 语句。例如在标准终端中的命令:
ssh user@host 'upload' < myfile.txt
希望通过 Java 库,而不是某种类型的 Runtime.exec()
试试: http ://www.jcraft.com/jsch/
这里有你需要的例子: http ://www.jcraft.com/jsch/examples/ScpTo.java.html