> List of tutorials

Table of contents for this tutorial

Base lesson 2, step 7: Pack the project into a JAR (JAva-Archive)-file and run the application out of this file.

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

Last revision of this document:
2006-03-06

This step of the tutorial
* covers the packing of different packages into a JAR-file using the 'Packaging Configuration' of Eclipse and
* and the command-line command to run the application with the inclusion of JAR-files for DOM and database-access.

Preface:

There is a functionality in Eclipse to pack a project in a JAR-file which is shown in Struts lesson 4a: A Test-Client to test the Session-Bean.
Nevertheless the 'Packaging Configurations' is used in this Tutorial as in the projects using Struts this knowledge is expanded for packing more than just JAVA-applications
.
Thereafter the simplified functionality is explained - I hope you understand my idea.

Credits:

I took the guideline for packing from the 'JBoss 3.0 Workbook For Enterpris JavaBeans 3rd Edition' by Bill Burke and Sacha Labourey.
As the 4th Edition is already available as hardcover, the book is no longer available for download.
Before you are going to buy this book: for a beginner, this book is not easy readable - it is a good textbook if you want to continue after my tutorials are finished.

Prerequisites:

Pack into a JAR (JAva-Archive):

Eclipse has a pretty sophisticated functionality to select files for further processing (not only packaging) and carry out the processing.
This functionality is based on the ANT (Another Neat Tool) but has a pretty easy to operate GUI.
  ;-) If you wrote ANT-scripts you will understand what I mean ;-) .

top.

Run the application outside Eclipse:

For the 'real-life' a JAVA-application is started by a command issued over the command-line.
This command also has to include the libraries (jar-files) with packages that are included in the developed application.

For this tutorial the following configuration was valid.
* developed application packed in file 'js_base02.jar' in directory '/home/kurti-o/js_tutorials/JS_Base02';
* libraries for the DOM-methods (Document-Object-Model) in file 'jdom.jar'
   in directory '/usr/java/j2sdk1.4.2_08/lib/extern';
* libraries for the access to the MySQL-database in file 'mysql-connector-java-3.1.12-bin.jar'
   in directory '/usr/java/j2sdk1.4.2_08/lib/extern'.

For your configuration please adapt your command !

top.

Next Step(s):

There is no direct continuation to this step.
Depending on your interest you may continue with the following tutorials