wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes Combining Unix with JAVA... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Combining Unix with JAVA..." Watch "Combining Unix with JAVA..." New topic

Combining Unix with JAVA...

Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Hi Everyone,

I just wanted to know that can i write a piece of code with which I login to an UNIX box, which I normally do in putty?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951

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.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link: http://aspose.com/file-tools
subject: Combining Unix with JAVA...
Similar Threads
smtp server error in javamail
Unix miliseconds
Unix for Java
to run a unix script