The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Trail: Servlets
Lesson: Running Servlets

Configuring and Running the JSDK Server

The server included with the JSDK2.1 is a small, multithreaded process that can run one or more servlets.

Unlike some web servers, the JSDK server does not automatically reload updated servlets. However you can stop and restart the server with very little overhead to run a new version of a servlet.

This section shows you how to

Setting up the JSDK Server

The Duke's Bookstore application runs on the JSDK2.1. First download the JSDK 2.1.

It is possible for you to configure various properties of the JSDK server before you start it. These properties include the server's port, which defaults to 8080, the hostname of the server, which defaults to localhost, and the document root, which defaults to the webpages subdirectory of the JSDK installation. To see or update these configuration values, edit the default.cfg file in the JSDK installation directory.

The Duke's Bookstore application is packaged so that it can be easily installed and run on the JSDK server. The complete binary and source code for the application is packaged in the zip archive tut-bookstore-21.zip. To install the application in the JSDK server, download the zip archive into the directory, JSDK2.1_HOME/webpages and unzip it. When you unzip the archive, the .class files (both the server classes and the helper packages cart and database) will be deposited in

    webpages/WEB-INF/servlets

The only manual step that you need to perform is to add the servlet properties(outside of the tutorial)contained in the file webpages/bookstore/servlets.properties to the file webpages/WEB-INF/servlets.properties

Starting the JSDK Server

To start the server, use the Unix-based Korn-shell script or the Windows-based batch file that the JSDK provides in the installation directory of the JSDK.

The following command starts the server on Unix:

     % startserver

And the following command starts the server on Windows:

     C:\jsdk\> startserver

Once the JSDK server is executing, you can use it to test your servlets.

Stopping the JSDK Server

To stop the server, the JSDK provides shut-down commands in the same directory as the start-up commands (the installation directory of the JSDK).

The following command stops the server on Unix:

     % stopserver

And the following command stops the server on Windows:

     C:\jsdk\> stopserver

Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form