14.3 H o w D o Y o u R u n a n Applet? | 667
14.3 How Do You Run an Applet?
As we said earlier, the applet must be run within a Web browser or an applet viewer. The
browser recognizes a link to a Bytecode file and the JVM within the browser executes the code.
Most Java systems provide an applet viewer that runs the Bytecode version of
the applet so that you can see the results. Although each system is different,
there is usually an HTML file associated with each applet that gives the name of
the compiled class to the viewer. The name of the class is typically the name of
the publicclass with a .classextension. Remember that the JVM executes
Bytecode, not Java code or machine language code.
Let’s first review a few fundamental facts about Web browsers. We will then
look at HTML, the language in which Web pages are written.
Web Browsers
The terms Internetand Webare often used as synonyms, but they are not. The
Internet is a network. A network is a collection of computing devices connected so
that they can communicate and share resources. A local area network (LAN)is a net-
work that connects a small number of nodes in a close geographic area. A wide area
network (WAN)is a network that connects two or more local area networks. The
Internetis a wide area network that spans the planet. In contrast, the Webis an in-
frastructure of information and the network software used to access it.
A Web page is a document that contains or references various kinds of data
as well as contains links to other Web pages. Web pages are referenced by their
Uniform Resource Locator (URL), such as http://www.jbpub.com. When you access a
Network A collection of con-
nected computing devices that
communicate and share
resources
Local area network (LAN) A
network in a close geographic
area
Wide area network (WAN) A
network that connects two or
more local area networks
Internet A wide area network
that spans the planet
Web An infrastructure of infor-
mation and the network
software used to access it
Uniform Resource Locator
(URL) The address of a Web
page on the Internet