Java Servlets and JSP
Java Servlets and JSP


Book summary

Table of contents

Who this book is for

What people say about this book

Related books

FREE downloads of chapters 1-5

What's on the CD

Instructor's Guide

Using newer versions of Tomcat and Java

FAQs

Book corrections

      Home | Books | Downloads | Trainers | Instructors | Customer Service

view cart

How to use Murach's Java Servlets and JSP with newer versions of Tomcat and Java

Note: If you want to learn how to use the most current releases of Tomcat and Java, we highly recommend using the 2nd Edition of this book.

When we wrote Murach's Java Servlets and JSP, the current software versions were Tomcat 4.0 and Java 1.4 (also known as J2SE 1.4 or SDK 1.4). Since then, however, Java 5.0 (also known as the J2SE 5.0 or JDK 1.5) and Java 6 (also known as Java SE 6 or JDK 1.6) have been released. In addition, there have been several new releases of Tomcat. Today, these are the current production quality releases of Tomcat:

Tomcat

J2EE spec

Servlet/JSP spec

Java (J2SE)

4.1

1.3

2.3 / 1.2

1.4 or 5.0

5.5

1.4

2.4 / 2.0

5.0 or 6

6.0

5

2.5 / 2.1

5.0 or 6

This table shows that each Tomcat release implements a different Java Enterprise Edition specification (also known as a Java EE or J2EE specification). For example, Tomcat 6.0 implements the Java EE 5 specification (which includes the servlet 2.5 and JSP 2.1 specifications) while Tomcat 5.5 implements the Java EE 1.4 specification.

This table also shows the Java releases that each Tomcat release works with. For example, Tomcat 5.5 is designed to work with Java 5.0 or 6 and won't work with Java 1.4 unless you download and install a compatibility package from the Tomcat web site. However, Tomcat 4.1 works equally well with Java 1.4 or 5.0.

Possible Tomcat and Java combinations

The code in Murach's Java Servlets and JSP is compatible with all of these new releases. However, to get that code to work right, you do have to make the changes that are described in the topics that follow.

Tomcat 4.0 with Java 1.4

If you don't have a compelling reason to use another version of Tomcat or Java, the easiest way to use this book is to install Tomcat 4.0 and Java 1.4 from the CD that goes with our book. Then, all of the applications, examples, and exercises will work just as they're described.

Tomcat 4.0 with Java 5.0

If you want to use Java 5.0 but you don't care about the Tomcat version, the easiest way to use this book is to install Tomcat 4.0 from the CD. Then, when you use the procedure shown in chapter 2 (figure 2-3) to set the JAVA_HOME variable, you just need to make sure to point to the directory for Java 5.0 like this:

set JAVA_HOME=C:\Program Files\Java\jdk1.5.0

As you progress through the book, you may get some warnings like this one:

C:\tomcat\webapps\murach\WEB-INF\
classes>javac business/Cart.java
Note: business/Cart.java uses unchecked or unsafe
operations.
Note: Recompile with -Xlint:unchecked for details.

However, you can ignore these warnings and continue if you want to. Or, if you prefer, you can recompile using the -Xlint:unchecked or deprecation switch to get more information about each warning, as in this example:

C:\tomcat\webapps\murach\WEB-INF\
classes>javac business/Cart.java -Xlint:unchecked
business/Cart.java:24: warning: [unchecked] unchecked call
to addElement(E) as a member of the raw type
java.util.Vector
                items.addElement(item);
                                ^
1 warning

Then, you can fix the warnings by using newer methods or classes so the code compiles without any warnings. If you have the skills presented in Murach's Beginning Java 2, JDK 5, you shouldn't have any trouble doing that.

Tomcat 4.1 with Java 1.4 or Java 5.0

If you want to use our book with Tomcat 4.1, you'll need to make a few changes to get all of the code presented in the book to work. Most of them involve configuring Tomcat 4.1 correctly. To make this process as easy as possible, we've summarized these changes in this document:

Tomcat 4.1 considerations (PDF)

Tomcat 5.5 with Java 5.0

If you want to use our book with Tomcat 5.5, we recommend that you use Java 5.0. That's because this version of Tomcat is designed to work with Java 5.0 and doesn't work with Java 1.4 unless you download and install a compatibility package. To get all of the applications, examples, and exercises in the book to work with Tomcat 5.5 and Java 5.0, you'll need to make a few changes as summarized in this document:

Tomcat 5.5 considerations (PDF)

Tomcat 6 with Java 6

If you want to use our book with Tomcat 6, you have to use Java 5 or 6. We recommend Java 6 since it's the most current. To get all of the applications, examples, and exercises in the book to work properly, you'll need to make a few changes as summarized in this document:

Tomcat 6 considerations (PDF)

In addition, a new edition of our servlet/JSP book that covers Tomcat 6 is now available. As a result, if you want to take advantage of the new Java EE features available from Tomcat 6, we recommend that you get this new edition.

Subsequent versions of Tomcat and Java

As new releases become available, we'll provide summaries of how to use Murach's Java Servlets and JSP with them, and we'll provide links to these summaries from this web page.



      To contact us, call us at (800) 221-5528 or email us at murachbooks@murach.com

      Home | Books | Downloads | Trainers | Instructors | Customer Service

view cart