Developing JavaServer Pages - Managing Java Classes (
Page 10 of 11 )
If you're using Tomcat 4.0, Figure 10 shows where and how to save your compiled Java classes (the .class files) so Tomcat can access them. Usually, you'll save your source code (the .java files) in the same directory, but that's not required.
Figure 10: Where and How to Save and Compile Regular Java Classes
Where the User class is saved
c:tomcatwebappsmurachWEB-INFclassesbusiness
Where the UserIO class is saved
c:tomcatwebappsmurachWEB-INFclassesdata
Other places to save your Java classes
c:tomcatwebappsyourDocumentRootWEB-INFclasses
c:tomcatwebappsyourDocumentRootWEB-INFclassespackageName
c:tomcatwebappsROOTWEB-INFclasses
c:tomcatwebappsROOTWEB-INFclassespackageName
The DOS Prompt Window for Compiling the User Class

Description
Although you can save the source code (the .java files) in any directory, you must save the class files (the .class files) in the WEB-INFclasses directory or one of its subdirectories. This can be subordinate to the ROOT directory or your own document root directory.
To compile a class, you can use TextPad's Compile Java command, your IDE's compile command, or the javac command from the DOS prompt window.
If you have trouble compiling a class, make sure your system is configured correctly as described in appendix A of my textbook.
The two paths shown at the top of this figure show where the User and UserIO classes that come with this book are saved. After that, the figure presents the syntax for other paths that can be used to store Java classes. If you review these paths, you'll see that each one places the Java classes in a subdirectory of the WEB-INFclasses directory.
|
Remember: this is from chapter four of Joel Murach's Java Servlets and JSP (Mike Murach & Associates, ISBN 1890774189, 2003). Grab a copy at your favorite book store today!
Buy this book now. |