| How to run the examples |

edtFTPnet/Compact has a wide range of examples available in the howto directory of the distribution.
There is one example per subdirectory. Each subdirectory is clearly labelled after its how to example, and contains at the minimum a Java file and run.bat. The run.bat file is used to compile and run the example Java class on Windows platforms. It can be easily converted to a shell script on Unix.
To run the examples, your environment must be set up. In the howto directory, there is an env.bat file that is called by all run.bat files to set up their environment. This file checks that JAVA_HOME is set correctly, and sets the CP variable for these examples (which is used to set the CLASSPATH). The CP variable is set as below:
set CP=.;..\..\..\..\lib\edtftpj.jar
Normally, env.bat should not need to be modified. If the CP variable is changed, ensure that "." is left in so that the compiled class file can be found. The path of edtftpj-pro.jar and license.jar files must be set in CP as shown.
To actually run an example after env.bat has been set up correctly, open a DOS window and cd into the subdirectory of the example you wish to run. Then simply type "run", and the Java file will be compiled and a usage message displayed:
Usage: ConnectToServer remote-host username password
In the example above, the message is saying that the remote hostname, username and password need to be supplied as arguments to run.bat. So to run the example, you would use:
run myhost myuser mypassword
The result (if successful) should be a few lines of debug, something like that shown below:
INFO [ConnectToServer] 3 Oct 2006 17:05:49.139 : Creating FTP client
INFO [ConnectToServer] 3 Oct 2006 17:05:49.219 : Setting remote host
INFO [ConnectToServer] 3 Oct 2006 17:05:49.239 : Connecting to server edtmobile
INFO [ConnectToServer] 3 Oct 2006 17:05:49.259 : Connected to server edtmobile
INFO [ConnectToServer] 3 Oct 2006 17:05:49.259 : Logging in with username=javaftp and password=javaftp
INFO [ConnectToServer] 3 Oct 2006 17:05:49.259 : Logged in
INFO [ConnectToServer] 3 Oct 2006 17:05:49.269 : Quitting client
INFO [ConnectToServer] 3 Oct 2006 17:05:49.279 : Example complete
Other examples may require additional arguments. These should always be clearly shown in the usage message displayed when run.bat is called with no arguments. Also, for each example, consult the corresponding How to documentation in this guide for detailed explanation of the concept.