Examples

SSHAPI is supplied with a number of examples to help get you started. The source for the examples is supplied with all distributions.

Preparing the examples

First off, you should download the binary distribution, and extract it somewhere. The following example assumes you have downloaded the archive to your home directory, and will be installing it there also.

On Unix/Linux/OSX

$ cd  
$ tar xzf sshapi-0.9.8-SNAPSHOT.tar.gz

On Windows

Use you preferred tool to extract the Zip file to wherever your %HOME% directory is.

Adding the providers

Now you need your provider libraries. See the links for where to obtain these. In our example, we will use J2SSH.

On Unix/Linux/OSX

We will assume you have downloaded and extracted the J2SSH archive to your HOME directory (and so the Jars should be in $HOME/j2ssh)

mkdir -p $HOME/.sshapi/providers
cp $HOME/j2ssh*.jar $HOME/sshapi-0.9.8-SNAPSHOT

On Windows

We will assume you have downloaded and extracted the J2SSH archive to C:\TEMP directory (and so the Jars should be in C:\TEMP\j2ssh)

MD %HOME%\.sshapi
MD %HOME%\.sshapi\providers
COPY C:\TEMP\j2ssh\j2ssh*.jar %HOME%\sshapi-0.9.8-SNAPSHOT

Running the examples

Now run one of the example applications.

Note that because all of the SSHAPI jars contain the ClassPath MANIFEST.MF, and they all exist in the same directory, you only need to add the examples jar itself. You do however have to add all jars for the provider.

For other environments, e.g. running the examples from an IDE, you may have to manually include the core, provider bridge and provider libraries yourself.

On Unix/Linux/OSX

cd sshapi-0.9.8-SNAPSHOT
java -classpath sshapi-examples-0.9.8-SNAPSHOT.jar:j2ssh-core-0.2.9.jar:j2ssh-common-0.2.9.jar E01Shell

On Windows

CD sshapi-0.9.8-SNAPSHOT
java -classpath sshapi-examples-0.9.8-SNAPSHOT.jar;j2ssh-core-0.2.9.jar;j2ssh-common-0.2.9.jar E01Shell