views:

102

answers:

5

How can I connect to an SSH server in Java? I don't need/want a shell. I just want to connect to the SSH server and get the content of, say, file.txt. How can I do that?

+3  A: 

Java doesn't support that natively, but you can use a library like JSch to do it

Michael Mrozek
+1  A: 

Take a look at Jaramiko.

Brian Clapper
A: 

You must use a third-party library - JSch is one of them. Google with "Java ssh" and you will get plenty of other options.

Petar Minchev
A: 

You could check JSSH, which is a Java SSH library.

Fortega
A: 

http://www.ganymed.ethz.ch/ssh2/ implements a ssh2 client in Java. I use it for port forwarding.

Thorbjørn Ravn Andersen