# 1

# Getting Started

Before You Begin · Setting your CLASSPATH

Installation and File Descriptions · Java Basics · JDK 1.0.2 and JDK 1.1

## Before You Begin

Be sure that your system and development environment (specifically the CLASSPATH) are set up correctly before installing JClass BWT; you should already be able to compile and run simple Java applications or applets. For help configuring your environment for Java, consult the Java (tm) Developer's Kit ( JDK) documentation at http://www.sun.com/products/jdk/index.html.

A good source of general information on Java and Java Beans is the Frequently Asked Questions (FAQ) list that can be found at the JavaSoft Web site at http://java.sun.com/products/jdk/faq.html and http://java.sun.com/beans/FAQ.html respectively.

## Setting your CLASSPATH

In order to use your JClass components, you must set the CLASSPATH environment variable of your operating system. The CLASSPATH points to the location(s) of class files on your computer or over a Local Area Network (LAN).

Note: If you installed the self-extracting MS-Windows version of JClass BWT, your CLASSPATH environment variable was automatically set up during the installation process.

### The CLASSPATH Statement

The CLASSPATH statement consists of directory paths to the location(s) of compiled Java class files on your computer or over a LAN. For JClass BWT, the statement must include a pointer to the ZIP file containing the JClass BWT classes. The following explains how to set the CLASSPATH environment variable under both Unix and Windows.

### Setting the CLASSPATH in MS Windows

If you have installed JClass BWT in the default location, C:\ jclass\ bwt[xxx]\ jclass\ bwt, (where [ xxx] is the JClass BWT version number) the CLASSPATH would be:

    C:\jclass\bwt[xxx]\jclass\bwt\lib\jcbwt[xxx]-classes.zip

If you have class files in more than one location, these are separated by semicolons:

    C:\jclass\bwt[xxx]\jclass\bwt\lib\jcbwt[xxx]-classes.zip;
    	C:\myclasses

If you want to be able to compile Java programs in the same directory as your class files are located, you must add a period to the CLASSPATH statement:

    C:\jclass\bwt[xxx]\jclass\bwt\lib\jcbwt[xxx]-classes.zip;.

The JClass BWT distribution includes additional classes in separate directories from the zip file. For the Java compiler to locate these files, you will also have to specify the root directory containing all of the classes; this is typically C:\

    C:\;C:\jclass\bwt[xxx]\jclass\bwt\lib\jcbwt[xxx]-classes.zip;.

The following explains Windows version-specific steps for setting the CLASSPATH:

#### Windows 95

Add the CLASSPATH statement to your autoexec.bat file using the set command ([x xx] is the JClass BWT version number):

    set CLASSPATH=C:\;C:\jclass\bwt[xxx]\jclass\bwt\lib\
    	jcbwt[xxx]-classes.zip;.;{other class file locations}

#### Windows NT (3.51 and higher)

Add the CLASSPATH environment variable to a Windows NT system by opening the System dialog box in the Control Panel, and searching the User Variables ( User Environment Variables in Windows NT 3.51) for an existing CLASSPATH:

- If a CLASSPATH exists, select it. In the Value field, add the path to your JClass BWT classes to the existing paths ([x xx] is the JClass BWT version number):

    	C:\[existing];C:\;C:\jclass\jcbwt[xxx]-classes.zip;.

- If no CLASSPATH environment variable exists, type the following in the Variable field:

    	CLASSPATH

- Then type your JClass BWT CLASSPATH in the Value field:

    	C:\;C:\jclass\jcbwt[xxx]-classes.zip;.

- Click OK.

Note to Browser Users: If you set the CLASSPATH for your entire session, the CLASSPATH will be picked up by the Web browser as well.

### Setting the CLASSPATH in Unix

Sun's Java JDK automatically sets the CLASSPATH environment variable in your startup file when you install the JDK. Enter the following command to see the current setting:

    echo $CLASSPATH

At the shell prompt.

To set the CLASSPATH environment variable in Unix to point to your JClass BWT classes, use a setenv command (where [ xxx] is the JClass BWT version number):

    % setenv CLASSPATH .:/usr/local/jclass/bwt[xxx]/
    		jclass/bwt/lib/jcbwt[xxx]-classes.zip

You can make the environment variable setting permanent by putting it in your startup file, (for example the .cshrc file for C shell users). To append the existing CLASSPATH in your startup file, add the following to the line specifying the CLASSPATH variable:

    :/usr/local/jclass/bwt[xxx]/jclass/bwt/lib/
    	jcbwt[xxx]-classes.zip

The colon at the beginning of the line separates different class file locations in the CLASSPATH environment variable.

If you want to be able to compile Java programs in the same directory as your class files are located, you must add a period to the CLASSPATH statement:

    usr/local/jclass/bwt[xxx]/jclass/bwt/lib/
    	jcbwt[xxx]-classes.zip:.

The JClass BWT distribution includes additional classes in separate directories from the zip file. For the Java compiler to locate these files, you will also have to specify the root directory containing all of the classes; this is typically your user directory (for example usr/local/):

    usr/local/bin/classes:usr/local/jclass/bwt[xxx]/jclass/bwt/lib/
    	jcbwt[xxx]-classes.zip:.

### JAR files and your CLASSPATH

If you are running an environment that can import a JAR file, use the JAR file in the / lib directory of your JClass product. Note, however, that some Java Bean environments have trouble resolving conflicts between the CLASSPATH and the imported JAR file. To run your program using the JAR file, you may have to remove the [jclass_product]classes.zip from your CLASSPATH.

## Installation and File Descriptions

JClass BWT is distributed in several forms, for different platforms and different versions of the JDK. For example, one distribution is in EXE format for JDK 1.0.2, another is in compressed TAR format for JDK 1.1. Once you obtain the distribution file you need, install JClass BWT:

- If the file is in ZIP or compressed TAR format, extract its contents to a directory on your system.

or

- If the file is in EXE format, double-click the file to run the automated setup program.

Extracting or installing the JClass BWT distribution creates the following core directory tree on your system (different distributions may contain additional directories or files):

- jclass/bwt/api/ [directory]
- jclass/bwt/applet/[directory]
- jclass/bwt/examples/ [directory]
- jclass/bwt/demos/ [directory]
- jclass/bwt/lib/jcbwt[xxx]-classes.zip [file] ([xxx] is the product version number)
- jclass/bwt/lib/jcbwt[xxx]-classes.jar [file] (JDK 1.1.x version only)
- jclass/readme.txt [file]

The jclass/bwt/api/ directory contains hypertext documentation of all of the JClass BWT classes in HTML format. To view the documentation, open jclass_bwt.html in a Frames-capable browser (such as Netscape Navigator or Internet Explorer). If you do not have a Frames-capable browser, open bwt_default.html instead, which explains how the JClass BWT API is arranged; then proceed to bwt_toc.html, the Table of Contents file.

The jclass/bwt/examples/ and jclass/bwt/demos/ directories contain sample Java programs that use JClass BWT components. Each directory contains the file index.html, which provides a convenient way of accessing the Java applets in the directory. The Java programs can also be run directly from the command prompt. They can also be accessed through the HTML documentation from jclass_bwt.html.

The jclass/bwt/lib/jcbwt[xxx]-classes.zip file ([x xx] is the JClass BWT version number) contains all of the JClass BWT Java .class files. Your CLASSPATH environment variable needs to point to this file. See the section on Setting your CLASSPATH for more information.

The jclass/bwt/lib/jcbwt[xxx]-classes.jar file contains the same JClass BWT Java .class files as the -classes.zip file, but in Java Archive ( JAR) format. The JAR format is used by many Integrated Development Environments (IDEs) for importing Java Beans.

The file jclass/readme.txt is an ASCII text file containing information about the files contained in this release. This file can be viewed through any text viewer (such as Notepad or WordPad) or a word processor.

#### The -classes.zip Archive

The core of JClass BWT is the jcbwt[ xxx] -classes.zip file ([ xxx] is the JClass BWT version number). This file contains all of the compiled .java files that comprise the JClass BWT Java components. If you plan to use the JClass BWT release files in a development environment, you do not have to extract (unarchive) the classes ZIP file because Java can automatically read the contents of this file. If you are using the JClass BWT release files in a server-based environment, however, you must extract (unarchive) the classes ZIP file so that the server can access the individual class files.

## Java Basics

Java is both a compiled and an interpreted language. After writing a Java program using a text editor, save it as a source file with the extension .java. When this source file is run through the Java compiler, it compiles the file into a .class`` file. Unlike .exe files, these compiled .class files are not directly executable under any operating system, because they do not contain machine-language code that can be understood directly by the microprocessor. Instead, they are compiled into a byte-code format consisting of machine-language instructions designed for a virtual microprocessor. This virtual microprocessor is the Java Virtual Machine, which interprets the byte-code into a machine-language code that can be understood by your system's microprocessor. As long as the Java Virtual Machine software exists for a computing platform, any Java programs you create will be able to run on that platform.

If the Java compiler and class files are installed in the standard places (typically \ JDK\bin\) you can compile a Java program by entering the following at a prompt:

    	javac MyJavaProgram.java

#### Compiling a Java Program

Java allows for two distinct program types: stand-alone applications and applets. Stand-alone applications can be run directly on a system containing the Java interpreter program (java), while applets can be inserted and run from Web pages when viewed through a Java-capable browser. JClass components can be used with both types of Java programs. Ensure you can compile and run simple Java applications or applets before you begin to use JClass LiveTable. Consult the Java JDK documentation for assistance in determining the location of the Java compiler (javac) and the Java .class files.

## JDK 1.0.2 and JDK 1.1

The Java Development Kit ( JDK) 1.0.2 and JDK 1.1 are two entirely different versions of the JDK. Applets and applications written for JDK 1.1 will not run in a JDK 1.0.2 environment. Applets and applications written for JDK 1.0.2 should run in a JDK 1.1 environment, but most do not run well.

All JClass products work with both JDK 1.1 and JDK 1.0.2. However, you must download the correct version for your environment.

JClass products made with JDK 1.0.2 are referred to as the " Transitional Bean" version of the product, and this is denoted by the capital letter "T" in the version name of the product (that is, JClass BWT 3.0T) and of the name of the file containing the JClass product's .class files (e.g. jcbwt[xxx]T-classes.zip -- where [ xxx] is the version number of the product). The JDK 1.1 version of JClass products drop the capital letter "T" from the version name of the product and from the file containing the compiled .class files. If you are developing programs under JDK 1.0.2, ensure you are using the Transitional Bean version of the product, and if you are using JDK 1.1, ensure you are using the non-Transition Bean version of the product.

Note: At the time of writing, Microsoft Internet Explorer 4.0 supports JDK 1.1 applets. Netscape has released a beta patch for its Navigator Web browser that supports JDK 1.1. You can also use the JDK 1.1 appletviewer or Sun's HotJava browser (freely available at http://www.sun.com/nav/download/index.html) to display HTML pages containing JDK 1.1 applets.

#### Determining the JDK and JClass BWT Version

If you are unsure of the version of the JDK on your system, type the following at the command prompt:

    	java -version

It will display the version number of the JDK on your system.

To determine the version of JClass BWT you are using on your system, run the version program provided:

    	java jclass.bwt.JCVersion

It will display the JClass BWT version number.

## JClass BWT and Java Beans

The new Java Development Kit ( JDK) 1.1 provides a number of new features and improvements over the previous release. In particular, it includes the ability to create "Bean" components.

Java Beans is a specification for reusable, pre-built Java software components. It is designed to be a full platform-independent component model written for the Java programming language. It enables developers to write components that can be re-used in other applications, reducing the total time needed to write complete applications. JClass BWT components are Java Bean-compliant.