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:
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
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 inexample
and a JDK 1.1 version of the same program inexample-1dot1
.We provide multiple versions of the same program for several reasons:
- Some developers can't upgrade to the latest version of the JDK right away because of existing applications and users.
- It's often useful to compare two different versions of the same program to learn what kinds of changes are required to migrate from one release to the next.
- Because browser support for applets typically lags the current release of the JDK, we sometimes provide multiple versions of each applet -- one that uses the latest version of the JDK, and one that users can run within their browsers.
- Some of the programs have been around since the original release of the JDK. Each version of the program represents a step in the natural migration of the program as the JDK evolves.
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 toexample-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.
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.
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 product page.