tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: newbie class path question
Date Tue, 04 Apr 2000 23:11:01 GMT
smarks@digisolutions.com wrote:

> Hi,
>
> So far I have been able to deploy a webapp other than example
> basically by cloning the examples app. I've even been able to have the
> new code call classes that exist in packages. (Pretty exciting, I
> know).
>
> However, I have not be able to have the intial servlet exist in a
> package. That is the servlet that the starts the webapp has no
> package.
>
> Here's my setup.
>
> webapps/myServlets/WEB-INF/classes/
>
> this directory contains com which is the tip of my packages.
>
> it also contanis a file called:
>
> EntryServlet.class which is the servlet that gets things going.
>
> I'd like to have this servlet exist in com/myCode/serlvets/
>
> or some such, but I can't figure out to configure this.
>

If you want this to be the case, then EntryServlet must be in package
com.myCode.servlets -- and the class file would be

    webapps/myServlets/WEB-INF/classes/com/myCode/servlets/EntryServlet.class


>
> Basically, I am asking how package configuration works under tomcat, I
> guess.
>

Exactly the same as package configuration for any other kind of Java classes.

If you've got the classes unpacked, you are putting a directory name on the
classpath (for servlets, Tomcat automatically does this for the
WEB-INF/classes directory of your app) and the directory structure underneath
this directory must reflect your package hierarchy.

>
> Also any info about WARchive files would be appreicate. Like how to
> create them.
>

Web ARchive files (WAR files) are simply JAR files with a particular
organization that is described in the Servlet API Specification, version 2.2
(downloadable at <http://java.sun.com/products/servlet>).  You can create one
with the "jar" utility.

In Tomcat 3.1, there is an Application Developer's Guide that can give you a
head start on constructing new applications built with the Ant tool (the same
way that Tomcat is).  This will be in the final release of 3.1, but for now
the best way to get it is:

- Download the most recent nightly build of Tomcat from:

    http://jakarta.apache.org/builds/tomcat/nightly

- Unpack this file, and point your browser at the following
  file (within wherever you unpacked it):

    tomcat/doc/appdev/index.html


>
> Thanks in advance,Spencer
>

Craig McClanahan



Mime
View raw message