Section 1.4. The Tools


1.4. The Tools

Making JBoss work involves more than just downloading and running JBoss. A cook certainly needs to know how to run the oven, but a lot of preliminary work must happen before the dish is ready for baking.

Professional chefs call this set up process "mis en place." They sharpen knives and place cutting boards within arms' reach. They prepare ahead of time ingredients they can safely cut up and measure before the dinner rush. Everything that can be done in terms of efficiency is handled up front so the culinary artist isn't distracted by mundane details.

Similarly, making JBoss work effectively requires you to do a bunch of work up front. Code must be compiled and packaged up in a specific way. You must wade through endless deployment descriptors. If one tiny piece of information doesn't match up with its companion in another file, the application will not deploy properly, and all of your hard work will be for nothing.

The mis en place of JBoss development involves other tools that make it easy to handle the mundane details of building and deploying your application. As in JBoss, you can download and use all of these tools for free:

  • Java

  • Ant

  • XDoclet

Let's talk briefly about how to install and configure them.

1.4.1. Installing Java

It probably goes without saying that the first thing you'll need is a working installation of Java. JBoss 4.0.2 is compatible with J2SE 1.4 or higher. We use J2SE 1.4.2 in this book, although nothing should prevent you from running the examples in Java 5.

Download the full JDK (Java 2 Development Kit) from Sun's web site (http://java.sun.com). Follow Sun's instructions for installing the JDK on your operating system. Next, create an environment variable called JAVA_HOME that points to the Java installation directory. Finally, add $JAVA_HOME/bin to the system path so you can run Java from the command line.

To verify your Java installation, type java -version at a command prompt. You should see Example 1-1.

Example 1-1. Output of java -version
 rosencrantz:~ sdavis$ java -version java version "1.4.2_07" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-215) Java HotSpot(TM) Client VM (build 1.4.2-50, mixed mode) rosencrantz:~ sdavis$ 

1.4.2. Installing Ant

We use Ant 1.6.5 to compile, package, and deploy the examples in this book. You can download it from http://ant.apache.org.

To install Ant, simply unzip the downloaded file to the directory of your choice. Next, create an environment variable called ANT_HOME that points to the Ant installation directory. Finally, add $ANT_HOME/bin to the system path so you can run Ant from the command line.

To verify your Ant installation, type ant -version at a command prompt. You should see Example 1-2.

Example 1-2. Output of ant -version
 rosencrantz:~ sdavis$ ant -version Apache Ant version 1.6.5 compiled on June 2 2005 rosencrantz:~ sdavis$ 

1.4.3. Installing XDoclet

We use XDoclet 1.2.3 to generate J2EE deployment descriptors, web.xml, and various other J2EE configuration files for the JAW Motors application. XDoclet is a combination of custom Ant tasks and special attributes that you include in your source code. You can download it from http://xdoclet.sourceforge.net.

To install XDoclet, unzip the downloaded file into the directory of your choice. Next, create an environment variable called XDOCLET_HOME that points to the XDoclet installation directory.

To verify your XDoclet installation, change to the $XDOCLET_HOME/samples directory and type ant at a command prompt. You should see Example 1-3.

Example 1-3. Output of ant
 rosencrantz:/Library/xdoclet-1.2.3/samples sdavis$ ant [many lines deleted for clarity] compile:      [echo] +---------------------------------------------------+      [echo] |                                                   |      [echo] | C O M P I L I N G   S O U R C E S                 |      [echo] |                                                   |      [echo] +---------------------------------------------------+     [javac] Compiling 109 source files to             /Library/xdoclet-1.2.3/samples/target/classes jar:      [echo] You can find the generated sources in the /samples/target/gen-src      [echo] directory and the compiled classes in the /samples/target/classes      [echo] directory. Enjoy! BUILD SUCCESSFUL Total time: 1 minute 23 seconds rosencrantz:/Library/xdoclet-1.2.3/samples sdavis$ 



JBoss at Work. A Practical Guide
JBoss at Work: A Practical Guide
ISBN: 0596007345
EAN: 2147483647
Year: 2004
Pages: 197

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net