Classes SSH-SCP for Java

X

Xavier

Hello,

I am searching for classes to use SCP (server use SSH2) in my Java
application.
Any idea ? Any link ?

Thanks

Xavier
 
R

Rogan Dawes

Xavier said:
Hello,

I am searching for classes to use SCP (server use SSH2) in my Java
application.
Any idea ? Any link ?

Thanks

Xavier
Google for "Java ssh2 scp"?

Go on, just try it! Hint: The 5th link pointing to linuxmafia is the one
you want. . . . .

Rogan
 
A

Alex Hunsley

Xavier said:
Hello,

I am searching for classes to use SCP (server use SSH2) in my Java
application.
Any idea ?

Learn how to use this really useful site called "Google".
 
B

Bryan Castillo

Rogan Dawes said:
Google for "Java ssh2 scp"?

Go on, just try it! Hint: The 5th link pointing to linuxmafia is the one
you want. . . . .

Can anyone out there comment on some of the ssh packages for java?
Have you tried any of them and were you happy with them? I tried
using jsch, it is one of the optional packages that ant 1.6+ uses for
its ssh tasks. I was trying to figure out how to execute commands via
ssh. The jsch packages seems like its built more for tunnelling X or
something..... It launches threads for input, error and output
streams and you have to wait for them to complete and there is no
event notification (like a listener) to tell you when IO is done.

I looked at the ant 1.6.2 code and it used a loop with a half-second
sleep.

[Snippet from ant.taskdefs.optional.ssh.SSHExec.java]

// execute the command
Session session = openSession();
session.setTimeout((int) maxwait);
final ChannelExec channel = (ChannelExec)
session.openChannel("exec");
channel.setCommand(command);
channel.setOutputStream(tee);
channel.setExtOutputStream(tee);
channel.connect();

// wait for it to finish
thread =
new Thread() {
public void run() {
while (!channel.isEOF()) {
if (thread == null) {
return;
}
try {
sleep(500);
} catch (Exception e) {
// ignored
}
}
}
};

thread.start();
thread.join(maxwait);

[end code snippet]

I thought it was a little messy and clumsy to have to code a sleep in
there to wait for IO completion of the ssh exec task.


I also looked at SSHTools and the API seemed very complicated.
Perhaps I'll take a look at it again, but I really didn't want to
write code to check keystores myself.
 
M

Michael Borgwardt

Xavier said:
If I post the question, it's that I have already searched on the web !!

If we answer "Try Google" it's that we cannot imagine someone having alread
searched on the web and not having found something. Which means that there
are two possible explanations:

- You are very bad at using search engines, in which case "Learn to use Google"
is the best solution to the problem.

- The SSH implementations that can so easily be found are not useable to you
for some reason - in which case you should have TOLD us that reason so that
we can help you find one that better matches your criteria.
 
A

Alex Hunsley

Xavier said:
Hi,




Oh, yes ! How if I had not thought of it !




Wouldn't this be ... "google" ?

Yes, it is google, that's what I said wasn't it?
.....

If I post the question, it's that I have already searched on the web !!

Xavier

Then you really do need to learn how to use a search engine. Google
returned lots of googd hits when I searched for a java ssh implementation.

alex
 
X

Xavier

I am searching for classes to use SCP (server use SSH2) in my Java
application.
Any idea ? Any link ?

OK, precisions : I need SSH2 implementation .... All I have found on the WEB
are implenting SSH1.

Xavier
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top