Java Reference
In-Depth Information
Applets are designed to be embedded within an HTML page.
■■
When a user views an HTML page that contains an applet, the code for
the applet is downloaded to the user's machine.
■■
A user must have a JVM on his or her machine. The JVM can be either a
plug-in of the Web browser or a separate runtime environment.
■■
The JVM on the user's machine creates an instance of the applet class
and invokes various methods during the applet's lifetime.
■■
Applets have strict security rules that are enforced by the Web browser.
The security of an applet is often referred to as sandbox security , compar-
ing the applet to a child playing in a sandbox with various rules that
must be followed.
■■
Other classes that the applet needs can be downloaded in a single Java
Archive (JAR) file.
■■
What is impressive about applets is that they are truly platform-independent
programs. I have seen many Java applications that are, of course, portable, but
there is no need for them to run on different devices. Because applets are a part
of a Web page, however, they can be accessed by any Web browser using any
operating system on any device, and therefore can be executed on many dif-
ferent platforms and devices. I can run an applet using Windows XP and
Internet Explorer, and you can run the same applet on a Macintosh running
Netscape Navigator.
If you are going to be developing applets, you should keep in mind that
they may be executed on many different machines. My experience with
applets is that they are great for developing Web applications, but that
you must be willing to accept the fact that some potential users of your
applet will not be able to run them. For example, if you write an applet
using J2SE 1.4, the user needs an up-to-date JVM. If my grandmother
needs to download and install the latest JVM plug-in to run your applet, I
can assure you she won't be visiting your Web site!
When the Internet was first popular in the mid-to-late 1990s, so were
applets. Nowadays, I see applets used for some amazing Web applications,
but I do not see them used for everyday Web pages. Don't be discouraged,
though. Applets play a key role in Java Web development. Keep in mind that
most Java code is written for the business world. It's a lot easier to make
sure everyone in your company has the right JVM for their Web browser than
to make sure that everyone else on the planet does. Knowledge of applets is
a must in real-world, distributed Java applications, so do not downplay the
importance of applets in Java.You need to have realistic expectations about
when and how they are used.
Search WWH ::




Custom Search