The "let" in the word servlet is to remind you that a servlet is not an application by itself. You can not just run it; it runs within another application, a Web server in this case.
You need a Web server that supports servlets installed on your computer and you already have one if you installed the JSDK. By installing the JSDK, you also installed a tiny little Web server.
The JSDK server is fairly useless as an ordinary Web server. The only requests it can handle are requests for servlets.
It can be used to test your servlets on your own machine. Like all servers, the JSDK server has to be started before you can use it.
To start the JSDK server from an MS-DOS prompt, change to the JSDK installation directory (c:\jsdk2.1) and type in the following command:
startserver
This will start the tiny Web server with the default settings, which should be fine for your purposes. (UNIX users also type
startserver
which is the full name of the command in the UNIX JSDK.)
You can specify the directory where the JSDK server looks for servlets by editing the file
default.cfg
located in the JSDK installation directory.
For example, to set this directory to the examples directory that comes with the JSDK, change the server.docbase property to examples. It should look like this:
server.docbase=examples
The servlets directory is located at
docbase/WEB.INF/servlets
If the JSDK server clashes with another server already installed on your system, you can change the server.port property in the default.cfg file as well.
Once the JSDK server is started, open a Web browser. In the address field, enter the URL,
http://localhost:8080/servlet/SimpleServlet
.
The following MouseOver explains the URL and shows how it looks in a browser.