Setting Up the Development Environment

OVERVIEW

Perspective for Java can be used with one of the following development platforms:

Perspective for Java works with these initial versions and later releases of Java development and run-time environments.

REQUIRED FILES

The files that you will need to use Perspective will be different depending on your development environment.

Files Required for a JDE

If you are using a Java Development Environment to develop Perspective JavaCharts, you need this:

The Perspective for Java .JAR file is the Perspective class library that must be included in the component library in a Java Development Environment. The .JAR file includes the applets, the class files, and the JavaBean information for Perspective.class. The .JAR file is available via the 3D web page at http://www.threedgraphics.com.

Files Required for a Browser

If you are using a Browser to develop Perspective JavaCharts, you need these files:

FILE LOCATIONS

The required file locations will be different depending on your development environment: a Java Development Environment (JDE) or a Java 1.1 compliant browser.

Using a JDE

The Perspective for Java .JAR file must be installed as a component in the JDE's component library. Use the documentation provided with your JDE to add this file to the component library.

Using a Browser

To create a full system on a local machine, install the files as follows:

  1. Create a directory on your hard disk.
  2. Copy the Perspective for Java .JAR file into the directory.
  3. Unzip the PFJ_GIFS.ZIP files into the same directory. The extracted files must reside in the same directory as the .JAR file.
  4. Create a "tiles" subdirectory. Unzip the PFJ_TILE.ZIP file into the "tiles" subdirectory.
  5. Unzip the sample code .ZIP files into the same directory. The extracted HTML and .java files must reside in the same directory as the .JAR file.

DEVELOPMENT REQUIREMENTS

Perspective for Java requires a browser with full 1.1 compatibility (i.e., at least 4.0 versions of either of the two major browsers or a development environment that is fully compatible with Java 1.1).

Java Bean

Perspective for Java requires a Java development environment with at least full Java 1.1 compatibility. Examples:

HTML

Perspective for Java requires a browser with at least full Java 1.1 compatibility:

Perspective for Java can also be used in any later versions of these browsers.

USING PERSPECTIVE IN A SERVLET

Perspective charts can be also be used in a servlet-based application. The following locations provide basic information about Java servlet development:

The technical resources page includes a number of useful articles and tutorials for developing and using servlets.

The Three |D| Graphics web page contains a number of well-documented example Java programs that illustrate how to use Perspective in a servlet-based application.

When a "server push" is used, the chart image will change and display updated data without the browser doing anything and without the user selecting the "Reload" button. Note that both of these servlets are basically the same. The first example only saves the image once. In the "server push" example, the .html file continuously forwards the browser back to the servlet. For more information, see the servlet documentation at Javasoft.

If you want to update a Perspective chart based on parameters passed to the servlet, remember that parameters are passed to a servlet in the URL. For example:

http://my.domain.com/servlets/
MyChartServlet?user=Bob&data=payroll&chartType=15 

In this example, three parameters are passed to the servlet called MyChartServlet:

user = Bob
data = payroll
chartType = 15

Depending on the parameters, you can display a different chart using the sample servlets provided above. Any parameters could be passed -- it just depends on how you want to develop your web application.

The value of each parameter can be obtained in your servlet's code using the following method:

ServletRequest.getParameter (String paramName)

For more information, see the servlet documentation at Javasoft.

If you want to allow the user to download a Perspective chart as a .gif image, the simplest solution is to display the chart in an .html page, and let the user download it using the functionality provided by the Web browser.

If this is not acceptable, you can directly download the chart image from a servlet (e.g., the user will see a "Save As..." dialog from the browser). To do this, write the .gif image to the OutputStream provided by the ServletResponse object. See the example DownloadGifServlet.java that implements this solution.

When you are ready to use the servlet on your Web site, you will need to check your Web Server's documentation. Different Web Servers have different mechanisms for deploying a servlet. In very general terms:

  1. You will need to place your servlet's .class file in a directory where it is accessible to your Web Server.
  2. You will need to change a configuration file of some kind, so the server can access the servlet. Some Web Servers may provide a graphical user interface for this purpose.