posted 14 years ago
Yes. Although if the client machine is running Windows I'm not quite sure how. Another *n*x box could simply Runtime.exec("/usr/bin/ssh"). I think putty may have a command-line option as well, but I'm not sure. I know the cygwin package does - it's the same basic ssh program as Linux uses.
Doing a Runtime.exec of a shell program can be a little tricky because it's conversational. You have to capture stdin and stdout and use them as your conversation channels. It's easier when you just want to remotely execute a single non-interactive program/script via ssh, since you only have to worry about the output and not the input.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.