0

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()

blink-fish
  • 171
  • 17

1 Answers1

6

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

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

rgrebski
  • 2,354
  • 20
  • 29