Using the Rexec class |
The Rexec class allows you to connect to a remote host and execute a command.
Example
// creates new Rexec instance Rexec rexec = new Rexec("server.com","jsmith","secret","ls -al",false);
// establish connection rexec.connect();
// executes ls -al command on server.com authenticating as user jsmith rexec.execute();
// disconnect rexec.disconnect(); |