Netscape Enterprise Server 3.5.1 and 3.6
Notes for Java Programmers

The Netscape Enterprise Server 3.5.1/3.6 includes a Java runtime environment that lets you deploy Internet and intranet ready applications. Using Java on the Netscape Enterprise Server, you can deploy applications to serve many purposes, such as database access, corporate intranet publishing, and electronic commerce. Your server-side Java applications are automatically portable, regardless of whether the server is running on a Unix or Windows system. If you want to run a Java application on the Netscape Enterprise Server 3.5.1/3.6, you should read this document. It provides information not covered in other Netscape documents, as well as links to other documents containing relevant information.

CONTENTS

USING JAVA IN THE NETSCAPE ENTERPRISE SERVER

There are four different ways to run Java applications on the Netscape Enterprise Server 3.5.1/3.6.

  1. You can use the Web Application Interface (WAI) for developing Java applications (you cannot use WAI with applets). See Writing Web Applications with WAI for information about
    • the interface definitions that facilitate WAI programming
    • examples that use the interfaces

  2. You can use the LiveConnect facility. If you are writing your application using both Java and JavaScript, see Writing Client/Server JavaScript Applications for information about using JavaScript and Java concurrently.

  3. Although this option is not recommended, you can use the server side applet (HttpApplet) interface and classes provided with Enterprise Server 2.0 for server-side Java programs. They are deprecated but are still supported for backward compatibility. Netscape does not plan further development on them; equivalent functionality is available to you through LiveConnect. The classes are documented in the book Programmer's Guide, Netscape Enterprise Server Version 2.0, (for Unix or for NT).

  4. You can use JavaSoft's Java Servlet API. The level of Servlet support is equivalent to the Java Servlet Development Kit (JSDK) 1.0.1 released by JavaSoft.

GETTING STARTED

This section contains information about configuring your environment, compiling Java classes, and executing your Java program for the Netscape Enterprise Server 3.5.1/3.6. The information in this section pertains to Java via the LiveConnect facility, Servlet API, or the HttpApplet interface only. For Java via WAI, please see Writing Web Applications with WAI..

CONFIGURING YOUR ENVIRONMENT

The installation process of the Netscape Enterprise Server 3.5.1/3.6 makes the standard Java classes available to you (packaged in the file serv3_0.zip ) on the path

<server root>/plugins/java/classes/serv3_0.zip

where <server root> is the directory in which you installed the server. This file is placed automatically in the list of places that the Java runtime engine  looks for classes when trying to load a class. In addition, the server looks for class files in the directories

<server root>/plugins/java/local-classes/

and

<server root>/plugins/java/applets/

The server also searches for classes in the directories specified in the CLASSPATH environment variable (of the user that the server is running as, or of the System section  in the environment variables part of Control Panel on Windows machines). Please note that when using the CLASSPATH, this environment variable needs to be set before the server is started, and in the environment that the server is started. On Windows systems, if the CLASSPATH is set in the System section of the environment variables part of Control Panel, you may need to reboot the machine before the new CLASSPATH is visible to the server.

If you have difficulty loading classes from a jar file, try unjarring/unzipping the file into a directory in the CLASSPATH.

If you are using jar or zip files, you need to add the complete path of the jar or zip file to the CLASSPATH environment variable (for example, /directory1/directory2/myclasses.zip). On Windows, different paths in the CLASSPATH variable must be separated by a semi-colon(;). On UNIX, paths must separated by a colon (:).

Due to a JVM limitation, compressed jar or zip files are not supported. The file must be uncompressed.

You may also chose to update the classpath directive in the obj.conf file to make your classes visible to the JVM. However, be aware that future administrative server actions for Server Side JavaScript or Java may result in the loss of changes made to the classpath directive. Also be careful to make additions only at the end of the classpath entry (as you usually do not want your classes to supercede the ones already bundled with the Netscape Enterprise Server, if they have the same names).

COMPILING JAVA CLASSES

Netscape's Java implementation on the Netscape Enterprise Server is a deployment environment, not a development environment. It includes a Java virtual machine and some of the Java classes from the Sun JDK 1.1. It does not include an Integrated Development Environment (IDE), nor does it include the JDK 1.1 compiler (javac), the Java command-line interpreter (java ), or the Java debugger (jdb). You can compile your custom-developed classes using any development environment which is compatible with JDK1.1.

EXECUTING YOUR JAVA PROGRAM

To run a Java program via the HttpApplet interface or Servlet API on the Netscape Enterprise Server 3.5.1/3.6, you must activate the Java runtime engine. You can do this from your Server Manager by following these steps:

  1. Click Programs and then choose the Java link.

  2. At the prompt "Activate the Java interpreter?", click Yes and then click OK.

  3. In the "Java (server side) applet directory" field, specify the directory containing your Java classes. The default directory for Java classes is

         <server-root>/plugins/java/applets
  4. In the "Java servlets directory" field, specify the directory that will contain your Java servlets. The default directory is

         <server-root>/plugins/java/servlets

For more information, see the Netscape Enterprise Server Administrator's Guide or consult the online help.

A Java program runs when a user specifies its URL. To get to the default directory for Java programs, specify one of the following URLs:

For example, to run the RandomApplet applet, one of the examples provided with Enterprise Server 3.5.1/3.6, the user specifies the following URL:

     <hostname>:<port>/server-java/RandomApplet

To run the BrowserDataServlet servlet, another example provided with Enterprise Server 3.5.1/3.6, the user specifies the following URL:

     <hostname>:<port>/servlet/BrowserDataServlet

To run a Java program via the LiveConnect facility, see Writing Client/Server JavaScript Applications for more information.

If you are using Java in a server-side JavaScript application through the LiveConnect facility, be aware that enabling JavaScript on the server also activates the Java runtime engine. However, that means of enabling server-side JavaScript only allows you to access the Java runtime engine through the LiveConnect facility. If you wish to deploy applications based on the HttpApplet interface or Servlet API, you must activate the Java runtime engine using the steps given above.

When the server executes Java programs, System.out and System.err are redirected to the Enterprise Server's error log.

NETSCAPE'S JAVA RUNTIME ENVIRONMENT

The Java runtime environment that Netscape includes with the Netscape Enterprise Server 3.5.1/3.6 is based on Sun's JDK 1.1, with additional features provided by Netscape.

SUPPORTED FEATURES OF JDK 1.1

The following new features of JDK 1.1 are supported:

For information about the core Java classes, see Sun's JDK API Reference.

UNSUPPORTED FEATURES OF JDK

Features of JDK not currently supported in ithe Netscape Enterprise Server 3.5.1/3.6 include the AWT 1.1 (server-side Java does not make use of graphical user interfaces), JNI, inner classes, internationalization, visible JavaBeans, and the security model.

Although the Enterprise Server 3.5.1/3.6 release does not entirely support the JDBC (including the JDK 1.1 JDBC-ODBC bridge), it does include some support for JDBC (see the previous section).

Calling C/C++ native code (through JNI, JRI, or JDK 1.02 style native methods) is NOT supported in the Enterprise Server JVM (for HttpApplets, Servlets, or LiveConnect).

NETSCAPE ENTERPRISE SERVER IIOP FEATURES

Netscape provides the following enhancements to support IIOP-based distributed objects in the Netscape Enterprise Server:

Please look at Netscape Internet Service Broker for Java Programmer's Guide and  Netscape Internet Service Broker for Java Reference Guide for more details.

SUPPORT FOR SERVLETS IN THE NETSCAPE ENTERPRISE SERVER

The Netscape Enterprise Server 3.5.1/3.6 includes support for JavaSoft's Servlet API. The server supports the level of the Java Servlet Development Kit (JSDK) 1.0.1. (For more information on Java Servlets, see the API documentation included with the Java Servlet Development Kit.)

Servlets are enabled when server-side Java applets (HttpApplets) are enabled. While HttpApplets are found in the following directory:

     <server root>/plugins/java/applets

servlets are found in the following directory:

     <server root>/plugins/java/servlets

Network downloading of servlets, servlet chaining and server-side includes for servlets are NOT supported.

Note, however, that there are some limitations to the servlet support. These limitations are documented in the Enterprise Server 3.5.1 Developer Notes and Enterprise Server 3.6 Developer Notes.

ENTERPRISE SERVER 3.5.1/3.6 CLASS LIBRARIES

The file serv3_0.zip contains the Java class libraries included with the Netscape Enterprise Server 3.5.1/3.6 for deploying HttpApplet, Servlet and LiveConnect applications. These packages and classes are listed below:

Note: The HttpApplet API (the netscape.server.applet, netscape.server.base, netscape.server.frame packages) is deprecated.

In addition, you should be aware of these sets of server-related Java classes that are included as part of Enterprise Server:

SAMPLE CODE

For the HttpApplet interface, the sample Java applet in Chapter 3 of Programmer's Guide, Netscape Enterprise Server Version 2.0 Programmer's Guide, (for Unix or for NT). continues to work with Enterprise Server 3.0.

For WAI,  see the code example WASP.java included in Writing Web Applications with WAI.

For LiveConnect,  see the example bugbase.java included in Writing Client/Server JavaScript Applications. 

For servlets, please see the example BrowserDataServlet.java in the directory <server-root>/plugins/java/servlets of your server installation.

LIMITATIONS

For a list of the known limitations in the Java VM included with Enterprise Server 3.5.1/3.6 for HttpApplet, LiveConnect, and Servlet applications, see the Netscape Enterprise Server 3.5.1 Developer Notes or Netscape Enterprise Server 3.6 Developer Notes.

APPENDIX A: PACKAGES INCLUDED AND SUPPORTED

The following packages are available for developers to use with the Java VM in the Netscape Enterprise Server 3.5.1/3.6. These classes are in the serv3_0.zip file and include core JDK 1.1 classes as well as Netscape classes.

In addition, the following packages are available to servlet writers in the servlet3_5.zip file

APPENDIX B: ADDITIONAL PACKAGES INCLUDED BUT NOT SUPPORTED

NOTE: The packages, classes, and interfaces in the java.awt and java.security hierarchies are not included and not supported in Netscape Enterprise Server.

The following additional Sun packages are included but are not supported with Netscape Enterprise Server 3.5.1/3.6.


Copyright Notice

Netscape Communications Corporation ("Netscape") and its licensors retain all ownership rights to this document (the "Document"). Use of the Document is governed by applicable copyright law. Netscape may revise this Document from time to time without notice.

THIS DOCUMENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN NO EVENT SHALL NETSCAPE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF USE OR DATA, INTERRUPTION OF BUSINESS, OR FOR INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY KIND, ARISING FROM ANY ERROR IN THIS DOCUMENT.

The Document is copyright © 1997 Netscape Communications Corporation. All rights reserved.

The Software includes encryption software from RSA Data Security, Inc. Copyright © 1994, 1995 RSA Data Security, Inc. All rights reserved. Portions of the Software include technology used under license from Verity, Inc. and are copyrighted. Portions of the Software copyright © 1994, 1995 Sun Microsystems, Inc. All rights reserved. Portions of the Software copyright © 1995 PEER Networks, Inc. All rights reserved. Portions of the Software copyright © 1996 Mortice Kern Systems, Inc. All rights reserved. Portions of the Software copyright © 1996, 1997 Symantec Corporation. All rights reserved.

The portion of the Software that provides the DBM function is copyright (c) 1990, 1993, 1994 The Regents of the University of California. All rights reserved. This code is derived from software contributed to Berkeley by Margo Seltzer. Redistribution and use in source and binary forms of the DBM code, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. All advertising materials mentioning features or use of this software must display the following acknowledgement:

This product includes software developed by the University of California, Berkeley and its contributors.

4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THE SOFTWARE WHICH PROVIDES THE DBM FUNCTION IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Netscape and Netscape Navigator are registered trademarks of Netscape Communications Corporation in the United States and other countries. Netscape's logos and Netscape product and service names are also trademarks of Netscape Communications Corporation, which may be registered in other countries. Other product and brand names are trademarks of their respective owners.

The downloading, export or reexport of Netscape software or any underlying information or technology must be in full compliance with all United States and other applicable laws and regulations. Any provision of Netscape software or documentation to the U.S. Government is with restricted rights as described in the license agreement accompanying Netscape software.

Any sample code included above is provided for your use on an "AS IS" basis, under the Netscape License Agreement - Terms of Use