The JavaTM Tutorial

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form

Trail: Servlets
Lesson: The servletrunner Utility

## Starting servletrunner (JSDK2.0)

> The `servletrunner` is in the `<jsdk>/bin` directory. You can run the utility more easily if this directory is on your search path. For example:

>     	% setenv PATH /usr/local/jsdk/bin:		(on UNIX)

>     	C> set PATH=C:\jsdk\bin;%PATH%			(on Win32)

> Invoking `servletrunner` with the `-help` flag shows a usage message without running it:

> >     % servletrunner -help
> >     Usage: servletrunner [options]
> >     Options:
> >       -p port     the port number to listen on
> >       -b backlog  the listen backlog
> >       -m max      maximum number of connection handlers
> >       -t timeout  connection timeout in milliseconds
> >       -d dir      servlet directory
> >       -r root     document root directory
> >       -s filename servlet property file name
> >       -v          verbose output
> >     %

> To see the default values of these options, call `servletrunner` with the -v option. This starts the utility; just stop it after you have obtained the information if you are not ready to run it yet, or want it to run with something other than the default values. On Unix for example, using the `kill` command stops `servletrunner`.

> >     % servletrunner -v
> >     Server settings:
> >       port = 8080
> >       backlog = 50
> >       max handlers = 100
> >       timeout = 5000
> >       servlet dir = ./examples
> >       document dir = ./examples
> >       servlet propfile = ./examples/servlet.properties

> > Note: In the default values printed above, `servlet dir`, `document dir` and the directory for the `servlet propfile` contain a dot ("`.`"). The dot designates the current working directory. The current working directory is typically the directory from which the executable was started. In this case, however, the dot refers to the directory where the servlet development kit is installed.

> > If you start `servletrunner` from a directory other than the installation directory, `servletrunner` first changes its current working directory (and, therefore, what you might think of as the value of the "`.`").

> Once `servletrunner` is executing, you can use it to test your servlets.

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form