About Our Examples

The Java Tutorial contains hundreds of complete working examples. Some of our examples are applets, others are standalone applications. For a complete list of the tutorial's applets, and what page to visit to run each one, refer to List of Applets.

This page contains four sections that discuss various aspects of our examples:

Example Directory Names

Each lesson in the tutorial contains one or more programming examples, each of which can be composed of one or more files. A lesson groups its examples in sub-directories according to the version of the JDK required and whether Swing is required.

A lesson might have one or more of the following example directories:

Example Directory Name Program Type JDK Release/Version Other libraries
example Applets and/or applications JDK 1.0.2  
example-1dot1 Applets and/or applications JDK 1.1  
example-1dot2 Applets and/or applications JDK 1.2  
example-swing Applets and/or applications JDK 1.1 Swing 1.1

Multiple Versions of the Same Program

Often, you can find multiple versions of the same program by looking in each of the example directories in a lesson. For example, you might find a JDK 1.0.2 version of a program in example and a JDK 1.1 version of the same program in example-1dot1.

We provide multiple versions of the same program for several reasons:

About the Applets Running in our Pages

Throughout the tutorial, you will encounter running applets. Our pages contain four different types of applets:
JDK 1.0.2 Applets
These applets are included with an <APPLET> tag and appear directly in content pages. Most browsers support 1.0.2, so most readers will have no trouble running these applets. We still run the 1.0.2 versions of the applets even if we have a 1.1 or higher version available because some older browsers don't support anything higher. This ensures that most of our readers can run the applet. These applets are followed by a note that looks like this (the links below don't work):

Note: Because some old browsers don't support 1.1, the above applet is a 1.0 version (here is the 1.0 code; here's the 1.1 code). To run the 1.1 version of the applet, go to example-1dot1/nothing.html. For more information about running applets, refer to About Our Examples.
JDK 1.1 Applets
These applets are included with an <APPLET> tag and appear directly in content pages. Some browsers still do not support 1.1. If your browser does not support 1.1, then you will not be able to run these applets. We run a 1.1 version of an applet only if no 1.0.2 version of the applet is available (usually because 1.0.2 doesn't support required functionality). These applets are followed by a note that looks like this:

Note: The above applet requires JDK 1.1. If you are using an older browser that does not support 1.1, you won't be able to run the applet. Instead, you need to view this page in a 1.1 browser, such as HotJava, the JDK Applet Viewer (appletviewer), or certain versions of Netscape Navigator and Internet Explorer. For more information about running applets, refer to About Our Examples.
JDK 1.2 Applets
These applets require Java Plug-in 1.2 or a 1.2 browser such as Applet Viewer. Because 1.2 support is not widely available and because we don't want to force people to download Java Plug-in if they can't or don't want to, 1.2 applets aren't included directly in content pages. Instead, the content page contains a snapshot of the running applet, which links to a separate page that contains the applet. These applets are followed by a note that looks like this:

Note: Because the preceding applet uses the Java 2 SDK 1.2 API, it requires Java Plug-in 1.2. It won't work with Java Plug-in 1.1.1, or Java Plug-in 1.1.2, or uncustomized 1.1 browsers. For more information about running applets in the tutorial, refer to About Our Examples. That page includes a section about Downloading Java Plug-in.
Swing Applets
These applets require Java Plug-in 1.1.2, Java Plug-in 1.2, a 1.2 browser such as Applet Viewer, or a specially configured 1.1 browser. Because Swing support is not widely available and because we don't want to force people to download Java Plug-in if they can't or don't want to, Swing applets aren't included directly in content pages. Instead, the content page contains a snapshot of the running applet, which links to a separate page that contains the applet. For more information about running Swing applets, see Running Swing Applets(in the  trail).

Swing applets are followed by a note that looks like this:


Note: Because the preceding applet uses the Swing 1.1 API, it requires Java Plug-in 1.1.2 or Java Plug-in 1.2. It won't work with Java Plug-in 1.1.1 or uncustomized 1.1 browsers. For more information about running applets in the tutorial, refer to About Our Examples. That page includes a section about Downloading Java Plug-in.

Downloading Java Plug-in

If you decide to download Java Plug-in, choose the version you download carefully.

Download Java Plug-in 1.2 if you want to run 1.2 applets. With Plug-in 1.2 you will be able to run 1.2 applets as well as 1.1+Swing applets. As of this writing, the tutorial contains only one 1.2 applet: an example in Playing Sounds.

Most of the applets in the tutorial that require Java Plug-in are 1.1+Swing applets. If you care only to run these applets, then download Java Plug-in 1.1.2. Also, download Java Plug-in 1.1.2 if you are developing your own applets under JDK 1.1 + Swing and want to test them.

To download Java Plug-in, visit the Java Plug-in(outside of the tutorial) product page.