> Overview (Steps)

Struts lesson 4a: A Test-Client to test the Session-Bean

For this document and all references (links) please obey the hints and regulations concerning copyright, disclaimer and trademarks.

Last revision of this document:
2005-08-29

This document describes the development of a simple Java-program under Eclipse to test the EJB developed in JS_Struts04 - Creating the Session-Bean with the Model.
This program allows to enter parameter via the command-line and see the output according to the entered parameter.

Credits:

Prerequisites:

Preparation:

Create a new project (named JS_Struts04a) in Eclipse:

Create separate directories for the source-code:

Define the 'Build Path' (were the compiler looks for Java-source-code):

Add other Projects (from were pre-compiled classes can be imported) to the 'Java Build Path':

Add Libraries (outside Eclipse) to the 'Java Build Path':

top.

Coding:

A short explanation of the code.

top.

Run / Test, Part 1:

top.

Pack into a JAR (Java Archive):

top.

Run / Test, Part 2:

As there have to been classes, which are distributed in several jar-files (Java-ARchives), to be incorporated, the parameters for the Java-command are not as simple as in the lesson JS_Base01 - HelloWorld.
All jar-files have to be 'collected' in a so called 'classpath'. This classpath can then be searched by the Java-Runtime when a class has to be loaded dynamically.

For a real application it is recommended, that the jar-files supplied by the Java-Application-Server are left in their original directories and the classpath contains the fully specified directory- and file-name.
For this lesson, the jar-files needed are copied to a common directory from where the client-program will be started.

top.

Related Documents: