blink-fish
blink-fish

Reputation: 171

SSH with Command and File in Java

I'd like to run SSH within Java but I haven't figured out how to run an SSH statement that includes a command and file. The command for example in a standard terminal:

ssh user@host 'upload' < myfile.txt

Hopefully via a Java library, not some type of Runtime.exec()

Upvotes: 0

Views: 249

Answers (1)

rgrebski
rgrebski

Reputation: 2594

Try: http://www.jcraft.com/jsch/

Here you have the example you need:
http://www.jcraft.com/jsch/examples/ScpTo.java.html

Upvotes: 6

Related Questions