Download Support Readiness Document for Java Servlet Development Kit

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Support Readiness Document
for
Java Servlet Development Kit
(JSDK) 2.0,
with 2.1 Addendum
Sun Microsystems, Inc.
Java Software
Support Readiness Document
for
Java Servlet Development Kit
(JSDK) 2.0
Sun Microsystems, Inc.
Java Software
901 San Antonio Road
Palo Alto, CA 94303
U.S.A.
Revision: 2.0
Release Date: August, 1998
Copyright 1998 by Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California 94303
All rights reserved.
This product or document is protected by copyright and distributed under licenses restricting its
use, copying, distribution, and decompilation. No part of this product or document may be
reproduced in any form by any means without prior written authorization of Sun and its
licensors, if any.
RESTRICTED RIGHTS: Use, duplication, or disclosure by the U.S. Government is subject to
restrictions of FAR 52.227-14(g)(2)(6/87) and FAR 52.227-19(6/87), or DFAR 252.2277015(b)(6/95) and DFAR 227.7202-3(a).
Sun, Solaris, Java, JDK, JavaServer, JDBC, and JavaBeans are trademarks, registered
trademarks, or service marks of Sun Microsystems, Inc. in the United States and other
countries.
THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT.
Production Note: This book was written in FrameMaker 5.0 for Solaris by Sarah Brehm, Holly
Hedeman and Lisa Walker, and updated by Lisa Walker.
Sun Microsystems, Inc.
Java Software
901 San Antonio Road
Palo Alto, CA 94303
U.S.A.
Table of Contents
Preface
iv
1.0 Java Servlet Development Kit (JSDK) Overview
1
1.1 Using Servlets 2
1.2 Servlet API Details 3
1.2.1 Package javax.servlet 3
1.2.2 Package javax.servlet.http 3
1.3 Changes to the Servlet API
1.3.1
1.3.2
1.3.3
1.3.4
3
New Interfaces 3
New Classes 4
New Methods 4
Name Changes Since Java Web Server 1.1 Beta
1.4 The Servlet Runner (servletrunner)
1.5 Loading and Invoking Servlets 6
4
5
1.5.1 Loading Servlets 6
1.5.2 Invoking Servlets 6
1.6 Product Distribution
6
1.6.1 Downloading the JSDK
1.6.2 Licensing 7
6
1.7 Localization and Internationalization 7
2.0 JSDK Requirements and Dependencies
7
2.1 System Requirements and Dependencies 7
2.1.1 Disk Space Needed to Install the JSDK 7
2.1.2 Supported Hardware Platforms; Required Boards or Peripherals
2.1.3 Recommended Amount of Memory 7
7
2.2 Software Requirements and Dependencies 7
2.2.1 Operating Systems and Versions Supported
2.3 Product Compatibility
7
8
2.3.1 Interoperability With Existing Third-Party Software 8
2.3.2 Backward/Forward Compatibility With Other Releases 8
2.3.3 Versions 8
3.0 JSDK Installation
8
3.1 Pre-Installation Considerations 8
SUN MICROSYSTEMS, INC.
i
Table of Contents
3.1.1 JDK Must be Installed and Working 8
3.1.2 Estimated Time Needed to Install 8
3.2 Installation Details
8
3.2.1 Default Installation Path 8
3.2.2 Changes to System Files 8
3.2.3 Directories Created During Installation
9
3.3 Tutorial: Download and Install the JSDK
9
3.3.1 Solaris 9
3.3.2 Microsoft Windows 95 and Windows NT 10
3.4 Post-Install Considerations 10
4.0 JSDK Configuration
10
4.1 Environment Variables
10
4.1.1 PATH to JSDK bin Directory 10
4.1.2 CLASSPATH Environment Variable 10
4.1.3 JAVA_HOME Environment Variable (Solaris Only)
4.2 Setting the Port for Servlet Runner 11
4.3 Stopping the Servlet Runner 11
4.4 Post-Installation
Considerations:
Installation 11
11
Verifying
Successful
4.4.1 Tutorial: Test the JSDK Installation by Starting the Servlet Runner
(Solaris) 11
4.4.2 Tutorial: Test the JSDK Installation by Starting the Servlet Runner
(Win32) 12
5.0 JSDK Deinstallation
12
5.1 How to Deinstall the JSDK
12
5.1.1 Solaris 12
5.1.2 Windows 95 or Windows NT 4.0
12
5.2 Common Problems With Deinstallation 12
5.2.1 Windows NT Registry Entries Not Deleted
12
5.3 Estimated Time Needed to Deinstall 13
5.4 Files Left Over After Deinstallation 13
6.0 Working with Servlets and the JSDK 13
6.1 Writing a Servlet
13
6.1.1 Tutorial: Creating the Example Servlet
13
6.2 Testing a Servlet With the Servlet Runner (servletrunner)
6.2.1 Tutorial: Starting the Servlet Runner and Testing Your Servlet
7.0 Troubleshooting
16
7.1 Common User Errors 16
7.2 Troubleshooting Tips & Tricks
7.2.1
7.2.2
7.2.3
7.2.4
7.2.5
15
15
16
Netstat 16
Ping 16
Telnet 16
Getting Servlets to Use Other Classes
Bug Information 17
SUN MICROSYSTEMS, INC.
16
ii
Table of Contents
8.0 Product Support and Reference Information
8.1 Information on the Web 17
8.2 Documentation in the JSDK Download
8.3 Mailing List 17
17
17
Addendum A: JSDK 2.1 A-1
SUN MICROSYSTEMS, INC.
iii
Preface
This document provides support readiness information for the Java Servlet Development Kit. The goal of Support Readiness Documents (SRDs) is to help support engineers prepare to support Java Software products. SRDs are not designed to provide
comprehensive product training (see the product documentation or Sun Education for
this). Instead, they focus on issues immediately relevant to support, such as installation,
configuration, and common user problems.
Document Format Options: PDF and PostScript
The Java Servlet Development Kit SRD can be viewed in PostScript or PDF format. The
PDF version of the document allows navigation via a table of contents frame, and provides the benefit of live cross references and web links. Text that is underlined and in
blue, such as the URL in this paragraph, are clickable links in the PDF version of the
document. Although the blue color and underlining appear in the PostScript version,
there are no live links when viewing that version.
Typographic Conventions
This document uses the following type conventions:
• The names of commands, files, Java™ objects, Java classes, and directories are
shown in regular monospace font.
• Text that is a placeholder to be replaced with a real name or value appears in italic
type; for example: % unzip jsdt-1.4.zip -d destination directory.
• The names of menu items, buttons, windows, and keyboard keys appear in regular
font with initial capitals, such as the Enter key.
• URLs that are clickable web links in the PDF version of the document are shown in
blue, underlined monospace font, as in http://java.sun.com. Although the blue
color and underlining appears in the PostScript version, there are no live links when
viewing that version.
• URLs that are not clickable web links are shown in regular monospace font, such as
jsdt://stard:5555/socket/Session/chatSession.
• Cross-references to other sections of the Java Servlet Development Kit SRD are
shown in regular font but are blue and underlined, as in, See Section 1.0, “ Overview.” In the PDF version of the document, these are clickable links to the indicated
SUN MICROSYSTEMS, INC.
iv
section. Although the blue color and underlining appears in the PostScript version,
there are no live links when viewing that version.
• New terms and book titles appear in italic type.
SUN MICROSYSTEMS, INC.
v
Java Servlet Development Kit (JSDK) Overview
Java Servlet Development Kit (JSDK)
1.0 Java Servlet Development Kit (JSDK) Overview
The Java™ Servlet Development Kit (JSDK) 2.0, in conjunction with the JDK™, contains all the pieces necessary for implementing servlets on Java-based web servers and
any web servers or servlet engines that implement the Java Servlet API. The JSDK
includes an implementation of the Java Servlet API, a servlet engine for running and
testing servlets, the javax.servlet and sun.servlet package sources, API documentation for javax.servlets, and example code to help developers get started writing servlets.
For a more thorough overview of servlets, please read the Java Servlet API White Paper
(http://java.sun.com/features/1997/aug/jws1.html).
The Java Servlet Development Kit is designed to allow the addition of servlet support to
any Java-based web server. Please note that most of the servers that are supported by the
JSDK are also supported by commercial products which also implement the Servlet
API. Wherever possible, it is recommended that you use a commercial product for running servlets in a production environment.
Servlets provide a Java-based solution that addresses the problems currently associated
with doing server-side programming, including inextensible scripting solutions and
platform-specific APIs. Servlets are Java server-side modules which fit seamlessly into a
Java-based server’s framework. The JSDK 2.0 is used by developers to create their own
servlets. Developers using the JSDK don’t have to worry about the particular server or
platform being used with their servlets.
Servlets are objects that conform to the Java Servlet API, therefore the servlets can be
plugged into any Java-based server. Servlets are to the server side what applets are to the
client side: object bytecodes that can be dynamically loaded off the network. They differ
from applets in that they are faceless objects—without a graphical user interface (GUI)
component. They serve as platform-independent, dynamically loadable, pluggable
helper bytecode objects on the server side that can be used to dynamically extend
server-side functionality.
SUN MICROSYSTEMS, INC.
1 of 18
Java Servlet Development Kit (JSDK) Overview
Note that the Java Servlet Development Kit is different from the JavaServer™ Toolkit.
The JavaServer Toolkit is a source code product for writing servers that is sold separately from the Java Web Server and the Servlet Toolkit. The Java Web Server is actually
written using the JavaServer Toolkit, and extended with servlets by using the JSDK.
The JSDK 2.0 is a separate download from the Java Web Server.
1.1 Using Servlets
• Java Servlets are a good replacement for CGI (Common Gateway Interface) scripts.
Java Servlets can be much less resource-intensive than CGI programs, and do not
have any of the maintainability problems inherent in scripting languages. Also, CGI
scripts are platform specific, whereas Java Servlets are platform-independent server
extensions, both in the sense of hardware and operating system, and web server type.
• Java Servlets are ideally suited to be the implementation of the middle tier in the
three-tier model for enterprise solutions. Servlets can serve as the business logic
which connects to SQL (Structured Query Language) databases via the JDBC™
database access API, while Java applets can handle the user interface.
• A servlet bean is a servlet that adheres to the JavaBeans™ design pattern for getting
and setting properties. A servlet bean has all the benefits of a regular Java bean. Java
beans can also be integrated into existing servlets or .jhtml files. These would be
beans with no user interface.
• Java Servlets can be used for dynamic HTML generation via Server Side Includes
(SSIs). The HTML will be created and placed in the .html file only when the web
page is accessed.
• Session tracking is a mechanism for building a sophisticated, stateful model on top
of the Web's stateless protocol. It can maintain state and user identity across multiple
page requests. It can also construct a complex overview of user behavior that goes
beyond reporting of user hits.
Session tracking interfaces and interfaces specific to HTTP session tracking are in
the javax.servlet.http package.
• A simple servlet can process data which was POSTed over HTTPS using an HTML
form, passing data such as a purchase order with credit card data. This would be part
of an order entry and processing system, working with product and inventory databases and perhaps an online payment system.
• Since servlets handle multiple requests concurrently, the requests can be synchronized with each other to support collaborative applications such as online conferencing.
• A community of active agents could be defined which would share work among each
other. The code for each agent would be loaded as a servlet, and the agents would
pass data to each other.
• One servlet could forward requests to other servers. This technique can balance load
among several servers which mirror the same content. Or it could be used to partition a single logical service between several servers, routing requests according to
task type or organizational boundaries.
SUN MICROSYSTEMS, INC.
2 of 18
Java Servlet Development Kit (JSDK) Overview
1.2 Servlet API Details
JSDK 2.0, in conjunction with the JDK 1.1 or higher, contains all that is necessary to
write, test, and run servlets. The kit includes servletrunner for testing servlets, the
jsdk.jar file containing the javax.servlet and sun.servlet packages for the
API and the javax.servlet source and API documentation. There is no API documentation for the sun.servlet package.
Below is a short description of the javax packages included in the JSDK. This API,
which is supported by most web servers that support Java and many third party servlet
engines, allows developers to create servlets written in the Java programming language.
JavaDoc-style documentation for the javax packages included in the JSDK can be
found at file:/path_to_jsdk/JSDK/doc/apidoc/packages.html, where
path_to_jsdk is the directory in which you installed the JSDK.
1.2.1
Package javax.servlet
• Contains the Servlet interface; within the Servlet interface are the method init
which creates the servlet, and the method service(ServletRequest, ServletResponse) which carries out a single request from a client. The simplest possible
servlet implements this method.
• Contains ServletRequest and SerlvetResponse interfaces which are for getting data from a client to a servlet, and to a client from a servlet, respectively
• Contains ServletInputStream abstract class which is used by ServletRequest to get data from a client
• Contains ServletOutputStream abstract class which is accessed via ServletResponse to return data to the client
• Contains GenericServlet class which implements the Servlet interface; servlets are easy to write by just subclassing GenericServlet
1.2.2
Package javax.servlet.http
• Contains HttpServlet abstract class which simplifies writing HTTP servlets;
HttpServlet is a subclass of GenericServlet, and contains doGet and
doPost methods which perform the HTTP GET and POST operations
• Contains HttpServletRequest and HttpServletResponse which allow the
servlet to manipulate HTTP protocol-specified header information
1.3 Changes to the Servlet API
The following are the latest additions to the Java Servlet API. These additions are
upwardly compatible for servlet developers. They will, however, affect developers who
write servers that load and use their own servlets, and developers who write servletembedding engines.
1.3.1
New Interfaces
• javax.servlet.http.HttpSessionBindingListener
• javax.servlet.http.HttpSessionContext
SUN MICROSYSTEMS, INC.
3 of 18
Java Servlet Development Kit (JSDK) Overview
• javax.servlet.SingleThreadModel
1.3.2
New Classes
• javax.servlet.http.HttpSessionBindingEvent
1.3.3
New Methods
• HttpServletRequest class
public abstract javax.servlet.http.Cookie getCookies() [];
public abstract javax.servlet.http.HttpSession getSession();
public abstract String getRequestedSessionId();
public abstract boolean isRequested SessionIdValid();
public abstract boolean isRequestedSessionIdFromUrl();
public abstract boolean isRequestedSessionIdFromCookie();
• HttpServletResponse class
public abstract void addCookie(javax.servlet.http.Cookie);
public abstract String encodeUrl(String url);
public abstract String encodeRedirectUrl(String url);
• HttpServlet class
protected void doDelete(HttpServletRequest req, HttpServletResponse resp)
protected void doOptions(HttpServletRequest req, HttpServletResponse resp)
protected void doPut(HttpServletRequest req, HttpServletResponse
resp)
protected void doTrace(HttpServletRequest req, HttpServletResponse
resp)
1.3.4
Name Changes Since Java Web Server 1.1 Beta
• HttpServletRequest class
getHttpSession → getSession
isRequestedSessionIdFromURL → isRequestedSessionIdFromUrl
• HttpServletResponse class
encodeURL → encodeUrl
encodeRedirectURL → encodeRedirectUrl
• HttpSession class
getSessionID → getId
SUN MICROSYSTEMS, INC.
4 of 18
Java Servlet Development Kit (JSDK) Overview
getSessionValue → getValue
getSessionValueNames → getValueNames
invalidateSession → invalidate
isNewSession → isNew
putSessionValue → putValue
removeSessionValue → removeValue
• HttpSessionBindingListener class
sessionValueBound → valueBound
sessionValueUnbound → valueUnbound
• HttpSessionContext class
getSessionIds → getIds
1.4 The Servlet Runner (servletrunner)
The Servlet Runner (servletrunner) can be used to test servlets if you don’t have an
actual server or just want the lower overhead of using the Servlet Runner. It is equivalent
to using appletviewer to test applets. The command to start the Servlet Runner is:
servletrunner -d servlet-dir
The argument servlet-dir specifies the directory containing the servlets you want to test.
The default directory is the current directory, so if the servlet you are testing is in the
current directory then no arguments need to be specified. In addition, the following
options are recognized by the Servlet Runner, along with the default values if the option
is not used:
•
•
•
•
•
•
•
-p port – port number to listen on (8080)
-b backlog – backlog parameter for accepting new connections (50)
-m max – maximum number of connection handlers (100)
-t timeout – connection timeout in milliseconds (5000)
-d dir – servlet directory (current directory)
-r root – document root directory (current directory)
-s filename – servlet properties file (servletdir/servlets.properties, where
servletdir is the directory specified with the -d option)
•
-v generate verbose output (off)
See Section 4.4, “Post-Installation Considerations: Verifying Successful Installation,”
for details on how to configure and start the Servlet Runner.
The Servlet Runner (servletrunner) does not work with JDK 1.2 beta 3.
SUN MICROSYSTEMS, INC.
5 of 18
Java Servlet Development Kit (JSDK) Overview
1.5 Loading and Invoking Servlets
1.5.1
Loading Servlets
Loading servlets is a function of the server or tool that invokes the servlet, therefore the
exact way a servlet is loaded is server- or tool-dependent.
In the case of servletrunner, servlets are loaded from the servlet directory specified
by the -d option. Servlets are run by servletrunner by calling them in your browser.
When servlets are updated, servletrunner does not automatically reload them.
In the case of the Java Web Server, a servlet invoker is a servlet that invokes the service method on a named servlet. The invoker servlet is used to load servlets from the
server_root/servlets/ directory. All other servlets are loaded through an internal
mapping. If the servlet is not already loaded in the server, then the invoker first loads the
servlet (either from local disk or from the network) and then invokes the service
method. As with applets, local servlets in the server can be identified by just the class
name. In other words, if a servlet name is not absolute, it is treated as local.
Servlets can be loaded into the Java Web Server from three places:
• From a directory that is on the CLASSPATH. The CLASSPATH of the Java Web Server
includes server_root/classes/ which is where the system classes reside.
• From the server_root/servlets/ directory. This is not in the server’s CLASSPATH. A custom classloader is used to create servlets from this directory. New servlets can be added, existing servlets can be recompiled, and the server will notice
these changes.
• From a remote location. For this a codebase like
http://nine.eng/classes/foo/ is required in addition to the servlet’s class
name. (This example must first be configured with the Java Web Server AdminTool).
1.5.2
Invoking Servlets
Servlets can be invoked by a client in the following ways:
• The client (browser) can ask for a document that is served by the servlet.
• The servlet can be invoked through servlet tags with Server Side Includes (SSIs).
• The servlet can be invoked by calling the servlet with
server_host_name:port/servlet/Servlet_Name, after placing it in the servlets
directory.
• The servlet can be invoked by using it in a filter chain.
1.6 Product Distribution
JSDK 2.0 is available from Sun for Solaris™, and for Microsoft Windows 95 and Windows 95 (also referred to collectively as Win32).
1.6.1
Downloading the JSDK
The JSDK is not available on CD-ROM, but is available for downloading from
http://java.sun.com/products/java-server/servlets/index.html.
SUN MICROSYSTEMS, INC.
6 of 18
JSDK Requirements and Dependencies
For the Solaris platform, the download file is a tar file. For the Microsoft Windows platform, the download file is a self-extracting file.
1.6.2
Licensing
JSDK 2.0 can be downloaded at no charge for development of Java compatible servlets.
In addition, the Servlet APIs may be embedded into any server at no charge. For information about other kinds of licensing, see Sun’s Licensing page at
http://java.sun.com/nav/business/index.html.
1.7 Localization and Internationalization
JSDK 2.0 supports internationalization. Servlets written with JSDK 2.0 can be localized.
2.0 JSDK Requirements and Dependencies
2.1 System Requirements and Dependencies
2.1.1
Disk Space Needed to Install the JSDK
Solaris
The Solaris download is about 300 KB. When installed, the JSDK directory is 645 KB.
Microsoft Windows
The Win32 download is about 950 KB. When installed, the JSDK directory is 640 KB.
2.1.2
Supported Hardware Platforms; Required Boards or Peripherals
JSDK 2.0 is supported on any hardware platform running the JDK 1.1 and subsequent
JDK versions. No additional boards or peripherals are needed.
2.1.3
Recommended Amount of Memory
The JSDK requires minimal memory. Other applications that you may use with the
JSDK should mandate the amount of memory, not the JSDK itself.
2.2 Software Requirements and Dependencies
2.2.1
Operating Systems and Versions Supported
Any platform that supports JDK 1.1 and subsequent releases is supported by JSDK 2.0.
The JSDK 2.0 can be downloaded from http://java.sun.com/products/
java-server/servlets/ in formats recognizable by the following platforms:
• Solaris 2.5.1 with ISS patches or higher (Solaris X86 is not officially supported and
does not run SSL)
• Microsoft Windows NT 4.0
• Microsoft Windows 95 (supported for development, but not for deployment)
SUN MICROSYSTEMS, INC.
7 of 18
JSDK Installation
Note: You should have at least JDK 1.1 when developing servlets. For up-to-date information on whether your target platform supports JDK 1.1, please contact the platform's
vendor.
2.3 Product Compatibility
2.3.1
Interoperability With Existing Third-Party Software
The Java Servlet API is being adopted or has already been adopted by many servers,
including Sun’s Java Web Server, Netscape servers, Microsoft IIS, and Apache Servers.
Because the Java Servlet API is being adopted by these servers, Java Servlets can run on
a variety of servers. Sun does not provide support for these third-party servers.
See http://java.sun.com/products/java-server/servlets/
environments.html for a list of servers supporting the Java Servlet API, and servers
supporting the Java Servlet API by using the JSDK.
2.3.2
Backward/Forward Compatibility With Other Releases
There have been a number of changes made to the Servlet API since releases 1.0 and
1.0.1, some compatible with 1.0 and 1.0.1 and some not. For a detailed description of
these changes, please see Section 1.3, “Changes to the Servlet API.”
2.3.3
Versions
• JSDK 1.0, 1.0.1 – previously available, but no longer distributed
• JSDK 2.0 – available now
3.0 JSDK Installation
3.1 Pre-Installation Considerations
3.1.1
JDK Must be Installed and Working
Be sure the JDK 1.1 or a subsequent release is installed on your machine and in working
condition.
3.1.2
Estimated Time Needed to Install
It takes less than 5 minutes to install the JSDK.
3.2 Installation Details
3.2.1
Default Installation Path
• Solaris – There is no default installation path
• Microsoft Windows – The default installation path is C:\
3.2.2
Changes to System Files
• Solaris – There are no changes made to system files during installation
SUN MICROSYSTEMS, INC.
8 of 18
JSDK Installation
• Microsoft Windows NT – Changes are made to the registry during installation; these
changes are related to InstallShield
3.2.3
Directories Created During Installation
Solaris
These directories are created in a directory called JSDK2.0 on Solaris
•
•
•
•
•
bin – contains Servlet Runner executable (servletrunner)
lib – contains JSDK JAR file
doc – contains servlet tutorial and apidoc directory for API documentation
examples – contains sample servlets and source code
src – javax.servlet class sources
Microsoft Windows
These directories are created in a directory called Jsdk2.0 on Windows
•
•
•
•
•
bin – contains Servlet Runner executable (servletrunner.exe)
lib – contains JSDK JAR file
doc – contains servlet tutorial and apidoc directory for API documentation
examples – contains sample servlets and source code
src – javax.servlet class sources
3.3 Tutorial: Download and Install the JSDK
3.3.1
Solaris
1. Download the JSDK compressed tar file from the JSDK web site:
http://java.sun.com/products/java-server/servlets/. The file is
called jsdk20-solaris2-sparc.tar.Z.
2. Move the compressed tar file to the directory where you want to install the
JSDK software. The JSDK directory will be created within this directory.
3. Uncompress the tar file. Enter:
% uncompress jsdk20-solaris-sparc.tar.Z
The tar file is now ready to be installed.
4. Install the contents of the tar file. Enter:
% tar -xvf jsdk20-solaris-sparc.tar
This creates a directory called JSDK2.0, which contains the product release.
5. After you have finished installing the JSDK you can delete the tar file if you wish. If
you don’t have to delete it for space reasons, it makes sense to keep it for a while.
Then if you have to reinstall for some reason, you don’t have to do the download
again.
SUN MICROSYSTEMS, INC.
9 of 18
JSDK Configuration
3.3.2
Microsoft Windows 95 and Windows NT
1. Download the JSDK self-extracting file from the JSDK web site:
http://java.sun.com/products/java-server/servlets/. The file is
called jsdk20-win32.exe.
2. Double-click on the icon for the self-extracting file and follow the instructions in the
Setup program to install the JSDK in a directory location on your hard disk. By
default, Setup installs the JSDK in C:\Jsdk.
3. After you have finished installing the JSDK you can delete the downloaded file if
you wish. If you don’t have to delete it for space reasons, it makes sense to keep it
for a while. Then if you have to reinstall for some reason, you don’t have to do the
download again
3.4 Post-Install Considerations
Check that the directory JSDK2.0 contains the directories listed in Section 3.2.3,
“Directories Created During Installation.”
4.0 JSDK Configuration
4.1 Environment Variables
Environment variables can give developers problems, so this section covers the environment variables that the JSDK uses.
4.1.1
PATH to JSDK bin Directory
You can temporarily add the JSDK bin directory to your search path for the current session by typing the following in a C shell on Solaris platforms:
% setenv PATH /path_to_JSKD_directory/JSDK2.0/bin:${PATH}
(on Solaris)
or typing the following at a command prompt on Windows platforms
C> set PATH=C:\Jsdk\bin;%PATH%
(on Win32)
You can permanently add the JSDK bin directory to your search path by following the
instructions below for your platform:
• Solaris – In your .cshrc file (or other shell configuration file) set the PATH variable
to include the JSDK bin directory.
• Windows NT – Add the path to JSDK bin to your path environment variable under
Control Panel → System → Environment.
• Windows 95 – Open the autoexec.bat file and add the path to JDSK bin to your
PATH environment variable.
4.1.2
CLASSPATH Environment Variable
The JSDK comes with two class packages which must be added to your CLASSPATH
before you can develop servlets. The easiest way to do this is to include
SUN MICROSYSTEMS, INC.
10 of 18
JSDK Configuration
/path_to_jsdk/JSDK2.0/lib/jsdk.jar in your CLASSPATH. You need JDK 1.1 or
subsequent releases in your CLASSPATH as well.
4.1.3
JAVA_HOME Environment Variable (Solaris Only)
When trying to start servletrunner, you may get the following message:
Error: Cannot find Java runtime in search path. Please set
JAVA_HOME.
because the your path does not include the JDK. There are two ways to correct the problem:
• Add the JDK path to the path statement in your .cshrc file or other shell configuration file; for example, the addition of
/usr/local/java/jdk1.1.6/solaris/bin in the statement below:
set path=($path /usr/local/bin:/usr/dist/exe:/usr/local/castanet/tuner/bin:/usr/local/java/jdk1.1.6/solaris/bin)
• Add a statement to your .cshrc file or other shell configuration file to set the
JAVA_HOME environment variable; for example,
setenv JAVA_HOME /usr/local/java/jdk1.16/solaris
Note: The addition to the path statement takes you to the bin level of the JDK whereas
the JAVA_HOME variable includes one level above bin.
4.2 Setting the Port for Servlet Runner
The default port for the Servlet Runner is 8080. Use the -p option if you want to specify
a different port. Note that the default port for the Java Web Server is also 8080. If you
have the Java Web Server running using that port, you will not be able to start the Servlet Runner with the default port as well. Either change the Web Server port or use the
switch to change the Servlet Runner port.
4.3 Stopping the Servlet Runner
Stop the Servlet Runner by typing Control-C in the command window where you
started it. On Solaris, you can also kill the process java sun.servlet.http.
4.4 Post-Installation Considerations: Verifying Successful Installation
To test your setup and ensure that it works correctly, start the Servlet Runner. This section steps through how to start the Servlet Runner on Solaris and Win32 platforms.
4.4.1
Tutorial: Test the JSDK Installation by Starting the Servlet Runner (Solaris)
This tutorial just tests your installation to make sure that Servlet Runner works. Use of
servletrunner is explained in more detail in Section 6.0, “Working with Servlets
and the JSDK.”
1. Add the JSDK bin directory to your search path. See Section 4.1.1, “PATH to JSDK
bin Directory” for details.
% setenv PATH /path_to_JSDK_directory/JSDK2.0/bin:${PATH}
2. Start the Servlet Runner.
SUN MICROSYSTEMS, INC.
11 of 18
JSDK Deinstallation
% servletrunner -v
The -v option (verbose) will give you startup information including what port the
Servlet Runner is using.
4.4.2
Tutorial: Test the JSDK Installation by Starting the Servlet Runner (Win32)
This tutorial just tests your installation to make sure that Servlet Runner works. Use of
servletrunner is explained in more detail in Section 6.0, “Working with Servlets
and the JSDK.”
1. Add the JSDK bin directory to your search path.
C> set PATH=C:\Jsdk\bin;%PATH%
2. Start the Servlet Runner
C> servletrunner -v
The -v option (verbose) will give you startup information including what port the
Servlet Runner is using.
Note: It is not a good idea to start the Servlet Runner by double-clicking on the servletrunner icon because then you cannot specify a directory to run servlets from. For
this tutorial it is not an issue, since we just want to see if it runs. When you are ready to
test servlets, however, you will want to either start servletrunner from the directory
containing your servlet or specify that directory using the -d option when you start
servletrunner from the command line.
5.0 JSDK Deinstallation
5.1 How to Deinstall the JSDK
5.1.1
Solaris
The JSDK does not have a deinstall script to remove the JSDK files from your machine.
To remove the JSDK files manually and deinstall the JSDK, type:
% rm -r JSDK2.0
5.1.2
Windows 95 or Windows NT 4.0
1. Open the Control Panel.
2. Click on Add/Remove Programs.
3. Highlight the JSDK entry in the window and click on Add/Remove.
5.2 Common Problems With Deinstallation
5.2.1
Windows NT Registry Entries Not Deleted
Windows NT stores its configuration information in a database called the Registry.
Sometimes registry entries will be left over after installation, and could interfere if you
reinstall. The Registry is not intended for user-level access, it is a system administrator’s
tool. See the Windows NT online help for more information.
SUN MICROSYSTEMS, INC.
12 of 18
Working with Servlets and the JSDK
To check for registry entries after deinstallation:
1. Start the registry editor by typing regedt32 at a command prompt.
2. Go to the HKEY_LOCAL_MACHINE panel.
3. Check the following for JSDK entries, and delete the JSDK key only:
SYSTEM/ControlSet001/Services/
SYSTEM/ControlSet002/Services/
SYSTEM/CurrentControlSet/Services/
4. During installation a key is also created in SOFTWARE/JavaSoft/ but this is usually
deleted without any problem when you use Add/Remove programs to remove the
software.
5.3 Estimated Time Needed to Deinstall
It should take less than 5 minutes to deinstall the JSDK.
5.4 Files Left Over After Deinstallation
• Solaris – No files left after deinstallation
• Windows – When you use Add/Remove Programs to deinstall in Windows, you have
to manually remove any files and directories that were created after installation,
since Add/Remove Programs will not remove them
6.0 Working with Servlets and the JSDK
As we discussed earlier, servlets can be written using the JSDK and can be used to add
functionality to your server.
6.1 Writing a Servlet
In order to write a servlet you need to use the Servlet API. The documentation for the
Servlet API is part of the JSDK download and can be accessed from your local directory
at URL file:/path_to_jsdk/JSDK2.0/doc/apidoc/packages.html or at
http://jserv.java.sun.com/products/java-server/
documentation/webserver1.1/apidoc/packages.html.
6.1.1
Tutorial: Creating the Example Servlet
Using the SimpleServlet.java file located in /path_to_jsdk/JSDK2.0/examples/ continue through the following steps.
1. Open the SimpleServlet.java file in any text editor. You should see the follow-
ing Java code (this is only the code portion of the .java file so your example will
look slightly different):
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
SUN MICROSYSTEMS, INC.
13 of 18
Working with Servlets and the JSDK
public class SimpleServlet extends HttpServlet {
public void doGet (
HttpServletRequest
request,
HttpServletResponse
response
) throws ServletException, IOException
{
PrintWriter
out;
String
title = "Simple Servlet Output";
// set content type and other response header fields first
response.setContentType("text/html");
// then write the data of the response
out = response.getWriter();
out.println("<HTML><HEAD><TITLE>");
out.println(title);
out.println("</TITLE></HEAD><BODY>");
out.println("<H1>" + title + "</H1>");
out.println("<P>This is output from SimpleServlet.");
out.println("</BODY></HTML>");
out.close();
}
}
Note: In this example, the service method provided by superclass HTTPServlet is
called every time the servlet is accessed. It writes “This is output from SimpleServlet”
to the response, which causes the phrase “This is output from SimpleServlet” to appear
on the display of the browser accessing the servlet.
2. Change the name of the class SimpleServlet to your own name or something that
is unique to you (for example, class HollyServlet extends HttpServlet).
3. Change the text in the line out.println("<P>This is output from Sim-
pleServlet") to something recognizable by you. This will be the output of your
servlet throughout the rest of the tutorials.
4. Save the file with same name that you changed your class name to in the first line of
code (e.g. with the example change made in Step 2, the file should be saved as HollyServlet.java). You can save the file to any directory you choose.
5. Compile this new file using the javac command. This should result in a .class
file, a complete servlet which you will use in the following tutorials.
SUN MICROSYSTEMS, INC.
14 of 18
Working with Servlets and the JSDK
Note: When compiling, don't forget to include the javax.servlet.* package in
your CLASSPATH. The easiest way to do this is to include
path_to_jsdk/JSDK2.0/lib/jsdk.jar in your CLASSPATH. You need the JDK 1.1
or higher in your CLASSPATH as well.
6.2 Testing a Servlet With the Servlet Runner (servletrunner)
The standard way to invoke a servlet in any server is with a URL like the following:
/servlet/servlet-name/path-info?query-args
The name of the servlet is servlet-name and is the class name of the servlet, path-info is
optional path information for the servlet, and query-args is optional query string arguments for the servlet.
For example, if you had started the Servlet Runner on host eno within the directory
samples containing sample servlets, then from any browser you could run SnoopServlet with the following URL:
http://eno:8080/servlet/SnoopServlet/foo/bar?a=z
This will invoke SnoopServlet with path info /foo/bar and query string a=z.
SnoopServlet will echo the request headers and query string arguments back to the
client.
Note: Remember that the default port for the Servlet Runner is 8080.
6.2.1
Tutorial: Starting the Servlet Runner and Testing Your Servlet
1. First, add the JSDK bin directory to your search path if you have not done so
already. (The command for Solaris shells other than C shell may be slightly different.)
% setenv PATH /path_to/JSDK2.0/bin:${PATH}
(on Solaris)
or
C> set PATH=C:\Jsdk2.0\bin;%PATH%
(on Win32)
2. Start the Servlet Runner (servletrunner).
% servletrunner -d path_to_servlet -v (on Solaris)
or
C> servletrunner -d path_to_servlet -v (on Win32)
Where path_to_servlet is the path to the directory where your .class file resides.
Another option is to cd into the directory where your .class file resides and then
start the Servlet Runner. Remember that the default port for the Servlet Runner is
port 8080, so if your Java Web Server is still running on this port, you will get an
error when you try the step below.
Note: Aside from the verbose startup information, you will not see any confirmation
that the Servlet Runner has started. The cursor will just blink in the terminal window.
3. Invoke your servlet using a browser.
SUN MICROSYSTEMS, INC.
15 of 18
Troubleshooting
Type the path to invoke your servlet in the text field for URLs (see the beginning of
Section 6.2, “Testing a Servlet With the Servlet Runner (servletrunner)” for
details).
You should see the text that you changed in your servlet before you compiled.
7.0 Troubleshooting
7.1 Common User Errors
• Because there is no clear communication that the Servlet Runner has started after
using the servletrunner command, people do not realize that the Servlet Runner
has started. Suggest using the -v option when they start servletrunner.
• People sometimes misunderstand that servlets work on the request/response paradigm. They expect a socket to open between their servlet and a database, for example.
• People sometimes misunderstand that the Servlet Runner will not serve document
files, just servlets—it is not a server. Why is there a -r option to specify a document
directory? Some methods in the JSDK require a document root, so you may want to
set it so a particular servlet can run.
• The Servlet Runner requires that the JDK be installed.
7.2 Troubleshooting Tips & Tricks
7.2.1
Netstat
To see if a port is bound, type netstat -a in a terminal window. This will give you a
list of all sockets currently active. The -a option means it will include those that are just
listening.
7.2.2
Ping
Type ping localhost in a terminal window. If that doesn’t work, there are network
problems that need to be solved before you try to run the server.
7.2.3
Telnet
To rule out your browser as the cause of problems, manually simulate the HTTP protocol:
1. Type telnet localhost port.
2. Type get / HTTP/1.0 and press Enter twice.
3. This will give you the raw HTML of the top web page. If this works, you know the
problem points toward the browser, not the server.
7.2.4
Getting Servlets to Use Other Classes
If you are having problems getting your servlets to use other classes, you can do either
of the following:
• put the other classes in the servlet directory (NOT on the CLASSPATH)
• put the servlet with the other classes in another directory (on the CLASSPATH)
SUN MICROSYSTEMS, INC.
16 of 18
Product Support and Reference Information
7.2.5
Bug Information
For bug information on this product, do a search for JSDK at
http://developer.java.sun.com/developer/bugParade
8.0 Product Support and Reference Information
8.1 Information on the Web
The main site for the Java Server Product family can be found at
http://jserv.javasoft.com/products/java-server/index.html. Below
are URLs for specific information.
• Java Servlet Development Kit (JSDK) Page –
http://jserv.java.sun.com/products/java-server/servlets
• Servlet Tutorial – http://jserv.javasoft.com/products/
java-server/documentation/webserver1.1/servlets/
servlet_tutorial.html
• Servlet API Documentation – http://jserv.javasoft.com/
products/java-server/documentation/webserver1.1/apidoc/
packages.html
• Servlet Environments – http://jserv.java.sun.com/products/
java-server/servlets/environments.html
• Servlet FAQ – http://jserv.javasoft.com/products/
java-server/documentation/webserver1.1/
servlets/servlets_faq.html
• Servlet API White Paper –
http://java.sun.com/features/1997/aug/jws1.html
• Java Web Server Page – http://jserv.java.sun.com/products/
java-server/webserver/index.html
• JavaServer Documentation – http://jserv.java.sun.com/products/
java-server/documentation/index.html
• Java Web Server and JSDK FAQs –
http://jserv.java.sun.com/products/java-server/faq/index.html
8.2 Documentation in the JSDK Download
• Servlet Tutorial –
file:/path_to_JSDK/JSDK2.0/doc/servlet_tutorial.html
• JavaDoc Servlet API documentation –
file:/path_to_JSDK/JSDK2.0/doc/apidoc/packages.html
8.3 Mailing List
Users can join the Java Web Server mailing list, jserv-interest, by sending email to
[email protected] with the message body of subscribe jserv-interest user_email_address. The user can also join the mailing list from the web page at
SUN MICROSYSTEMS, INC.
17 of 18
Product Support and Reference Information
http://jserv.java.sun.com/products/java-server/lists.html. The
mailing list can be used to monitor current issues that other users are discussing and to
ask questions.
An archive of messages from the jserv-interest list is available at
http://hplbwww.hpl.hp.com/people/ak/archives/jeeves/. This site is
not a Sun Microsystems site.
SUN MICROSYSTEMS, INC.
18 of 18
Addendum A: JSDK 2.1
1.0 JSDK 2.1 Overview
Java Servlet Development Kit (JSDK) 2.1 contains a simple Servlet engine for developing and testing servlets, the javax.servlet package sources, and API documentation.
JSDK 2.1 is a full reference implementation of the JSDK API 2.1 specification.
JSDK 2.1 is 100% pure Java and Y2K compliant.
1.1 Changes and New Features in Version 2.1
This section contains new features and major changes since JSDK 2.0.
1.1.1
New Classes
• javax.servlet.RequestDispatcher
1.1.2
New Methods
• javax.servlet.ServletContext
getAttributeNames()
getContext(java.lang.String uripath)
getMajorVersion()
getMinorVersion()
getRequestDispatcher(java.lang.String urlpath)
getResource(java.lang.String path)
getResourceAsStream(java.lang.String path)
removeAttribute(java.lang.String name)
setAttribute(java.lang.String name java.lang.Object object)
• java.servlet.ServletRequest
getAttributeNames()
setAttributeNames(java.lang.String key, java.lang.Object o)
• java.servlet.GenericServlet
SUN MICROSYSTEMS, INC.
A-1 of 9
JSDK 2.1 Overview
log(java.lang.String message, java.lang.Throwable t)
• java.servlet.ServletException
ServletException(java.lang.String message, java.lang.Throwable
rootCause)
ServletException(java.lang.Throwable rootCause)
• java.servlet.http.HttpSession
setMaxInactiveInterval()
1.1.3
Changed Methods
• java.servlet.ServletContext
log(Exception exception String msg)
changed to
log(java.lang.String message, java.lang.Throwable throwable)
1.1.4
Deprecated Interfaces
• javax.servlet.http.HttpSessionContext – deprecated for security reasons
1.1.5
Deprecated Methods
• javax.servlet.http.HttpServletRequest.isRequestedSessionIdFromUrl – use method isRequestedSessionIdFromURL instead
• javax.servlet.ServletContext.getServlet – This method was originally
defined to retrieve a servlet from a ServletContext. In this version, this method
always returns null and remains only to preserve binary compatibility. This method
will be permanently removed in a future version of the Java Servlet API.
• javax.servlet.ServletContext.getServletNames – This method was
originally defined to return an Enumeration of all the servlet names known to this
context. In this version, this method always returns an empty Enumeration and
remains only to preserve binary compatibility. This method will be permanently
removed in a future version of the Java Servlet API.
• javax.servlet.ServletContext.getServlets – This method was originally defined to return an Enumeration of all the servlets known to this servlet
context. In this version, this method always returns an empty enumeration and
remains only to preserve binary compatibility. This method will be permanently
removed in a future version of the Java Servlet API.
• log(java.lang.Exception exception, java.lang.String msg) – Deprecated. Use log(String message, Throwable throwable) instead.
• javax.servlet.ServletRequest.getRealPath(java.lang.String
msg) – Use java.servlet.ServletContext.getRealPath(java.lang.String msg)instead.
• javax.servlet.http.HttpServletRequest.isRequestSessionIdFromUrl – Deprecated. Use javax.servlet.http.HttpServletRequest.isRequestSessionIdFromURL instead.
SUN MICROSYSTEMS, INC.
A-2 of 9
Product Distribution
• javax.servlet.http.HttpServletResponse.encodeUrl(String url) Use javax.servlet.http.JttpServletResponse.encodeUrl(String
url) instead.
• javax.servlet.http.HttpServletResponse.setStatus(int sc,
java.lang.String sm) – Deprecated because of ambiguous meaning. To send
an error with a description page, use javax.servlet.http.HttpServletResponse.sendError(int sc, String msg).
• javax.servlet.http.HttpSession.getSessionContext - Deprecated
with no replacement method
1.1.6
Configuration File Changes
The JSDK configuration files have changed significantly. To set general server properties, such as port and hostname, edit the default.cfg file in the installation directory
of the JSDK. To edit servlet mappings, mime types and other properties, edit the respective files in installation_directory/webpages/WEB-INF.
1.1.7
Servlets Directory Location
The servlets directory is located at installation_directory/webpages/WEBINF/servlets.
1.1.8
Automatic Servlet Reloading
Automatic servlet reloading is not operational in this release of the JSDK. If a servlet is
replaced with an updated version while the server is running, clients running the servlet
will not get the updated version.
1.2 Localization and Internationalization
JSDK 2.1 supports internationalization. Servlets written with JSDK 2.1 can be localized.
2.0 Product Distribution
JSDK 2.1 can be downloaded from http://java.sun.com/products/
servlet/index.html at no charge for development of Java compatible servlets. In
addition, the Servlet APIs may be embedded into any server at no charge. For information about other kinds of licensing, see Sun’s Licensing page at
http://java.sun.com/nav/business/index.html.
3.0 Requirements and Dependencies
3.1 System Requirements and Dependencies
3.1.1
Disk Space Needed to Install JSDK 2.1
Note this is the disk space needed to install, not to download. The size of the download
is listed in Section 4.1, “Name and Size of Download Files”.
• Microsoft Windows – 1.12 MB
SUN MICROSYSTEMS, INC.
A-3 of 9
Downloading JSDK 2.1
• Unix – 1.21 MB
3.2 Software Requirements and Dependencies
3.2.1
OS and Versions Supported
JSDK 2.1 supports the following operating systems:
• Microsoft Windows 95, Windows 98 and Windows NT
• Solaris 2.6
JSDK 2.1 works on Linux and Macintosh, although these are not officially supported
platforms.
JSDK 1.2 supports the following versions of the JDK:
• JDK 1.1.x – JDK 1.1.8 is recommended
• Java2 SDK 1.2.x
3.2.2
Other Software Requirements
Java2 SDK is not included in the JSDK download, therefore it must be downloaded and
installed separately.
3.3 Product Limitations
Automatic servlet reloading is not operational in this release of the JSDK.
3.4 Product Compatibility
3.4.1
Interoperability with Existing Sun and Third-Party Software
See http://java.sun.com/products/servlet/runners.html for an up-todate list of software that conforms to the servlet API specification and will run servlets.
3.4.2
Backward and Forward Compatibility With Other Versions
Programs writetn using JSDK 2.1 can be run with version 2.0, as long as no new classes
or methods are used. Programs written using version 2.0 can be run with version 2.1 as
long as no methods which have been removed are used. See Section 1.1, “Changes and
New Features in Version 2.1” for a list of new, removed and deprecated classes, interfaces, and methods..
4.0 Downloading JSDK 2.1
4.1 Name and Size of Download Files
Some general tips on downloading from Sun can be found on
http://java.sun.com/feedback/faq/downloading.html
SUN MICROSYSTEMS, INC.
A-4 of 9
Installing JSDK 2.1
Platform
File Name
Size
Solaris
jsdk2_1-solsparc.tar.Z
466387 bytes
MS Windows
jsdk2_1-win.zip
375128 bytes
4.2 Steps to Download
JSDK 2.1 can be downloaded from
http://java.sun.com/products/servlet/index.html.
4.2.1
Unix Download
1. In the “Download JSDK Software” section, select UNIX (Solaris and others) from
the “Choose a Platform” pull-down. Click continue.
2. Read the license agreement and click Accept.
3. Click “FTP download” or any of the 3 alternate sites.
4. From the “Save As” window, store jsdk2_1-solsparc.tar.Z in a directory
where you would like the jsdk directory to reside.
4.2.2
Windows Download
1. In the “Download JSDK Software” section, select “Windows 95/NT” from the
“Choose a Platform” pull-down. Click continue.
2. Read the license agreement and click Accept.
3. Click “FTP download” or any of the 3 alternate sites.
4. From the “Save As” window, store jsdk2_1-win.zip in any directory.
5.0 Installing JSDK 2.1
5.1 Pre-Installation Considerations
5.1.1
Java2 SDK Requirements
Java2 SDK must be installed and working. The java program included in the SDK
must be included in the user’s path.
5.1.2
Disk Space
Make sure there is enough disk space; see Section 3.1.1, “Disk Space Needed to Install
JSDK 2.1”.
5.1.3
Estimated Time Needed to Install
Installation takes less than five minutes to complete.
SUN MICROSYSTEMS, INC.
A-5 of 9
Installing JSDK 2.1
5.2 Installation Details
5.2.1
Default Installation Path
• Solaris – current directory/jsdk2.1
• Microsoft Windows – c:\unzipped\jsdk2.1
5.2.2
Changes to System Files
There are no changes to system files on any platform.
5.2.3
Directories Created at Installation
The jsdk2.1 directory created at installation contains the following
• default.cfg – default configuration file for the server
• etc – directory containing Java code to start the HttpServer
• examples – directory containing example servlets, including source code, html files
and property files
• LICENSE or LICENSE.TXT – text file containing license agreement
• README or README.TXT –text file containing changes to the JSDK, troubleshooting, and instructions on running the servlets with servletrunner
• server.jar – archive file containing classes and files necessary for running a
server
•
•
•
•
•
servlet.jar – archive file containing classes in the servlet package
src – directory containing source code for javax.servlet
startserver, startserver.bat – startup script for servletrunner
stopserver, stopserver.bat – shutdown script to stop servletrunner
webpages – directory containing docs, a directory containing JSDK documentation in HTML format, and WEB-INF, a directory containing the servlet directory and
servlet properties files
5.3 How to Install JSDK 2.1
5.3.1
Unix Installation
1. In a terminal window, type the following command to unzip the file.
Unix prompt% gunzip jsdk2_1-solsparc.tar.Z
This creates a tar file called jsdk2_1-solsparc.tar.
2. In a terminal window, type the following command to unarchive the JSDK.
Unix prompt% tar -xvf jsdk2_1-solsparc.tar
This creates the jsdk2.1 directory.
3. The tar file can be deleted now.
5.3.2
Windows Installation
The download file is in zip format, so use the program WinZip to unarchive jsdk2_1win.zip
SUN MICROSYSTEMS, INC.
A-6 of 9
JSDK 2.1 Uninstall
1. Start WinZip and choose to use the Wizard.
2. Choose jsdk2_1-win.zip from the list of zip files and click Next.
3. Enter a directory name where you want the jsdk to reside, otherwise the default
directory c:\unzipped\jsdk2_1-win will be used.
4. Select Unzip Now.
5. Select Close to exit WinZip.
6. The zip file can be deleted now.
6.0 JSDK 2.1 Uninstall
6.1 Pre-Uninstall Considerations
6.1.1
Estimated Time Needed to Uninstall
Less than 5 minutes is needed to uninstall JSDK 2.1.
6.2 How to Uninstall JSDK 2.1
6.2.1
Unix
There is no script to remove JSDK 2.1, therefore use the following command from a terminal window to delete JSDK 2.1.
Unix prompt% rm -r path_to_JSDK/jsdk2.1
6.2.2
Windows
There is no executable to remove JSDK 2.1, therefore select the jsdk2.1 folder and
select Delete under the file menu.
7.0 Key File Descriptions
List and explain the function of: most common files used by product that a user might
utilize or modify, configuration files, most used binaries (daemons, bin files) and packages.
8.0 Using JSDK 2.1
In order to run the JSDK it is necessary to have installed a compliant Java2 SDK (JDK).
You must also have the java program available in your path (set using the PATH environment variable). More information can be found at
http://java.sun.com/products/jdk.
SUN MICROSYSTEMS, INC.
A-7 of 9
Bug Information
8.0.1
Starting the Server
To run the server that comes with the JSDK, there is a Unix based Korn Shell Script and
a Windows based Batch File provided in the installation directory of the JSDK. To
startup the server on Unix:
Unix prompt% cd installation_directory
Unix prompt% startserver
To start up the server on Windows
Windows prompt> cd installation_directory
Windows prompt> startserver
Once the server is running, you can use any web browser to browse
http://localhost:8080
and you will be browsing pages served from the server. You can read the JavaDoc documentation for the javax.servlet packages as well as see some examples.
8.0.2
Stopping the Server
To stop the server, use the following commands:
Unix prompt% stopserver
Windows prompt > stopserver
9.0 Bug Information
To view bug information on this product, do a search for JSDK at
http://developer.java.sun.com/developer/bugParade
10.0 Tuning and Troubleshooting
10.1 Common User Questions
A third-party FAQ is available at the following web site.
http://www.purpletech.com/java/servlet-faq.
10.2 Known Bugs and Their Workarounds
10.2.1
Issues
Known issues with JSDK 2.1 can be found at http://java.sun.com/
products/servlet/knownIssues.html
SUN MICROSYSTEMS, INC.
A-8 of 9
Reference Information
10.2.2
Out of Environment Space Error
On a Windows 95 or Windows 98 machine you may see an “Out of Environment Space”
error message when starting the server. This is caused by Windows providing too small
a space for environment variables. Do the following to work around this limitation:
1. Close the MS-DOS window (the error can corrupt its CLASSPATH variable) in
2.
3.
4.
5.
6.
7.
8.
which you attempted to start the server.
Open a new MS-DOS window.
Click on the MS-DOS icon at the top-left of the window.
Select the Properties option.
Click on the Memory tab.
Adjust the Initial Environment drop-down box from Auto to 2816.
Click OK.
Start the server by typing startserver at the prompt.
11.0 Reference Information
11.1 Technical Documentation
• installation_directory/jsdk2.1/webpages/docs/api/overviewsummary.html – JSDK API documentation included in the installation
• http://java.sun.com/products/servlet – Sun’s main JSDK page
• http://java.sun.com/products/servlet/external-resources.html
– list of external sources for servlet technology
11.2 Additional References
To subscribe to the external JSDK mailing list, send a message to [email protected] with the following message body:
subscribe servlet-interest your full email address
SUN MICROSYSTEMS, INC.
A-9 of 9