# Chapter 3

# The Java Browser and the World Wide Web: A Primer

### CONTENTS

- Navigating the World Wide Web
- Using URLs
  - How URLs Are Defined
  - URL Formats
- Web Surfing with Java-Enhanced Browsers
  - HotJava
  - Netscape Navigator
  - Oracle PowerBrowser
  - Internet Explorer
  - Liquid Reality
- Web Hot Spots for Java Developers
  - Sun's Web Site
  - JavaSoft
  - Gamelan
  - JARS
- Third-Party Java Tools
  - Borland C++ for Java Developers
  - Symantec Café
  - Symantec Espresso and Symantec Caffeine
  - Rogue Wave's JFactory
  - SunSoft's Java Workshop
- A Brief Tour of Live Applets on the Web
  - Dimension X Café
  - WallStreetWeb
  - Celebrity Painter
  - DigSim
  - 3D Netris
  - SGI Java-Powered Home Page
  - SportsZone
- Summary

The Web is a powerful interface to everything the Internet has to offer. A few years ago, when people thought of the Internet, they equated it with the monotony of low-level protocols like FTP and Telnet. Today, when most people think of the Internet, they think of the dynamic environment that enables them to search through and access complex "webs" of text, graphics, sound, and video. In short, they equate the Web with the Internet-and that's because the Web has swallowed the Net.

## Navigating the World Wide Web

Navigating the Web can be as easy as activating a hypertext link. The power of hypertext is in its simplicity and transparency. Users can navigate through a global network of resources at the touch of a button. Hypertext documents are linked together through keywords or specified hot areas within the document. These hot areas could be graphical icons or even parts of indexed maps.

When a new word or idea is introduced, hypertext makes it possible to jump to another document containing complete information on the new topic. Readers see links as highlighted keywords or images displayed graphically. They can access additional documents or resources by selecting the highlighted keywords or images.

To look through hypertext documents, you need a browser. A browser is a software application that enables you to access the World Wide Web. When a hypertext document is loaded in your browser, you can activate a link by moving your mouse pointer to the area of the link and clicking the left mouse button.

Generally, text containing a hypertext link is underlined and displayed in a different color than other text on the page. By default, most browsers display links that you have not visited in blue and links that you have visited in purple or light red.

As you point-and-click your way through the Web, you probably do not think about the URLs you are using to access Web resources. However, if you plan to display Java applets on the Web, you should stop and think about the URLs you use. When you move your mouse pointer over a link, most browsers display the URL path to the file or object that will be retrieved when you activate the link. This is useful for identifying the type of file referenced by the link.

Most Web documents written in the Hypertext Markup Language (HTML) have the `htm` or `.html` extension. For example, the URL path `http://www.tvp.com/idn/idnframe.html` tells the browser to use the Hypertext Transfer Protocol (HTTP) to obtain a file called `idnframe.html` in the `idn` directory on the `www.tvp.com` Web server.

Although following text-based links on Web pages is easy, following links embedded in graphic objects sometimes isn't. Some clickable images are displayed on the page with a distinctive blue border-this type is easy to identify. Other clickable images, however, have no borders around them at all, primarily because that Web publisher chose to use the extensions to HTML that enable the suppression of the border around images. So, how do you know when an image is clickable and when it is not if it has no distinct border?

One way to tell if the image is clickable is to move your mouse pointer over the image. If your browser shows that a URL (pronounced "you-are-el") path is associated with the image, you can click on it. Most images used on the Web are in either GIF or JPEG format. GIF images usually have a `.gif` extension. JPEG images usually have a `.jpg` or `.jpeg` extension. For example, the URL

> `http://www.tvpress.com/idn/idnttl.gif`

tells the browser to use the hypertext transfer protocol to obtain a GIF image called `idnttl.gif` in the `idn` directory on the `www.tvpress.com` Web server.

URLs are much more powerful and complex than these simple examples suggest. The next section takes a closer look at the structure of URLs and how they are used on the Web.

## Using URLs

Uniform resource locators (URLs) provide a uniform way of identifying resources that are available using Internet protocols. To better understand URLs, you should learn how they are defined and the formats for them.

### How URLs Are Defined

URLs consist of characters defined by the ASCII character set. The URL specification allows for the use of uppercase and lowercase letters, but uppercase letters are generally not used. Not using uppercase letters avoids confusion when moving documents from a system that is case sensitive to one that isn't and vice versa.

Although URLs consist of characters defined by the ASCII character set, you cannot use all ASCII characters in your URLs. You can use the letters a-z, the numerals 0-9, and a few special characters. The special characters include asterisks, commas, dollar signs, exclamation points, hyphens, parentheses, periods, plus signs, single quotation marks, and underscores. You are limited to these special characters because other characters used in URLs have specific meanings. For example, the tilde character is used to map URLs to HTML directories in a user's home directory.

Note
A detailed look at URL formats, syntax, and reserved characters is beyond the scope of this book. For an authoritative plain-English look at URLs, I recommend Web Publishing Unleashed from Sams.net. Chapter 3, "Publishers' Tour of the Web," covers everything Web publishers should know about URLs.

### URL Formats

The basic mechanism that makes URLs so versatile is their standard naming scheme. URL schemes name the protocol the client will use to access and transfer a particular file. Web clients use the name of the protocol to determine the format for the information that follows the protocol name. The protocol name is generally followed by a colon and two forward slashes (`//`). The colon is a separator. The double forward slash marks indicate that the protocol uses the format defined by the Common Internet Scheme Syntax.

The Common Internet Scheme Syntax is a common syntax for URL schemes that involve the direct use of Internet Protocol-based protocols. IP-based protocols specify a particular host on the Internet by a unique numeric identifier called an IP address or by a unique name that can be resolved to the IP address. The information following the double slash marks follows a format that is dependent on the protocol type referenced in the URL. Here are two general formats:

> `protocol://hostname:port/path_to_resource
> protocol://username:password@hostname:port/path_to_resource`

Hostname information used in URLs identifies the address to a host and is broken down into two or more parts separated by periods. The periods are used to separate domain information from the hostname. Common domain names for Web servers begin with `www` (for example, `www.tvp.com` identifies the Web server called `tvp` in the `commercial` domain).

Ports are rather like telephone jacks on the Web server. The server has certain ports allocated for certain things, such as port 80 for your incoming requests for hypertext documents. The server listens on a particular port. When it hears something, it-in essence-picks up the phone and connects the particular port.

Port information used in URLs identifies the port number to be used for the connection. If you do not specify a port number, a default value is used by your browser as necessary. Therefore, you do not have to specify port numbers in your URLs unless the connection will be made to a port other than the default.

By specifying the username and password information in a URL, you allow users to log into a system automatically. The two protocols that use both username and password information are FTP and Telnet. In an FTP session, the username and password information is often used to allow users to log into FTP servers anonymously. When a connection is made to an FTP server and the username and password information is not specified, the following default values are assumed: `anonymous` or `guest` for the username and the user's e-mail address as the password.

In Telnet, there are no default values. If you do not supply the username and password, the user will be prompted for this information, which is good because you don't want everyone to be able to remotely log into your server. You could allow users to log in automatically by specifying a user and password in your URL. However, you generally do not want to specify a personal password in a URL. Therefore, if you want users to be able to log in automatically using Telnet, you should create a guest account with a generic password. In this way, you can strictly control the access guests have on your system.

The final part of a URL is the path to the resource. This path generally follows the directory structure from the root or slash directory to the resource specified in the URL.

## Web Surfing with Java-Enhanced Browsers

Browsers are available for use on almost any computer operating system, including Amiga, Macintosh, OS/2, Windows 3.1, Windows 95/NT, and UNIX. You can think of a browser as your window to the Web; if you change your browser, you get a whole new view of what's out there. Use Lynx, and your window to the Web has only text. Text-only browsers are the original browsers for the Web. Although it might be hard to believe, several text-only browsers are still being developed.

Use ncSA Mosaic, and your window to the Web has text and graphics. Browsers that allow you to view Web documents containing text and graphics are the second generation of browsers, which are largely responsible for the phenomenal success of the Web.

Use HotJava, and your window has text, graphics, and live animation. Browsers that allow you to view Web documents containing text, graphics, inline multimedia, and live applications are the third generation of browsers that are driving the Web's transition to an extremely visual medium that rivals television for information content and entertainment value.

### HotJava

The HotJava browser, developed by Sun Microsystems, Inc., is written entirely in Java. As the first browser to support Java applets, HotJava is extremely popular. Although the Alpha version of HotJava supports only Java Alpha, more recent versions of the browser support the 1.0 API. Versions of the browser are available for Macintosh, Windows 95/NT, and Sun Solaris.

Although HotJava is popular, it is not feature rich like some of the other Java-enhanced browsers; it has a rather plain interface and limited extras. Still, HotJava is currently in the testing stages and may yet evolve into a full-featured browser.

Figure 3.1 shows JavaSoft's HotJava page. To learn more about HotJava and to download an evaluation version, visit JavaSoft at the URL

Figure 3.1 : JavaSoft's HotJava page.

`http://www.javasoft.com/java.sun.com/HotJava/index.html`.

### Netscape Navigator

The Netscape Navigator is the most widely used Web browser; versions of it are available for Macintosh, Windows, and UNIX X Window systems. Driven by Netscape's rise as a commercial corporation worth hundreds of millions of dollars, all of Netscape's products are shifting to a commercial model. However, you can download free versions of Netscape Navigator at the Netscape Web site. Netscape's Web site is shown in Figure 3.2. The URL to this site is

Figure 3.2 : Websurfing with Nerscape Navigator.

> `http://home.netscape.com/`

Not only does Navigator support Java, but it is undoubtedly the most feature-rich browser available today. It supports HTML 3.0, plug-ins, JavaScript, and unique Netscape extensions to HTML, such as frames. With HTML 3.0, you get support for tables, figures, and all the advanced features of HTML. Plug-ins allow you to add modules for inline video, sound, and multimedia. JavaScript, a scripting language modeled after Java, enables you to do client-side scripting.

Before you download the Navigator, keep in mind that only versions 2.0 and later support Java. Furthermore, although Netscape Navigator is available for a wide variety of platforms, Java support is limited to those platforms to which the JDK has been ported.

### Oracle PowerBrowser

PowerBrowser is everything you would expect in a browser created by the database giant Oracle. The PowerBrowser software package includes a local database called Blaze, which enables you store and manage large amounts of data efficiently. The browser also supports HTML 3.0 and extensions to the HTML standard including backgrounds, tables, embedded objects, and Java. Developers
versions of Oracle PowerBrowser for Windows 95 are available free of charge for evaluation.

Figure 3.3 shows Oracle's site on the Web at `http://www.oracle.com/`. To learn more about PowerBrowser and download the free Beta, visit this site.

Figure 3.3 : Learning about the Oracle PowerBrowser.

### Internet Explorer

One of the most powerful browsers currently available is the Internet Explorer from Microsoft. This full-featured browser took the Web by storm in 1995 and quickly moved to the number-two position in popularity. Versions of Internet Explorer are available for Macintosh, Windows 95, and Windows NT.

Internet Explorer supports HTML 3; all Netscape extensions; and powerful multimedia extensions including background sounds, scrolling marquees, and inline video movies. Versions 3.0 and later also feature support for Java, ActiveX controls, and VBScript. With the release of the Internet Explorer VR extension that enables full VRML capability, Internet Explorer is definitely the browser to watch. Microsoft is also developing an enhanced version of VRML called ActiveVRML, with which you can create animated VRML worlds that take advantage of Java.

Figure 3.4 shows the Internet Explorer home page at Microsoft. The URL for the Internet Explorer home page is `http://www.microsoft.com/ie/default.htm`. From this page, you can access the most current version of the browser and obtain upgrade modules like Internet Explorer VR.

Figure 3.4 : Learning about Internet Explorer.

### Liquid Reality

Like Internet Explorer VR, Liquid Reality is a VRML add-on module for Web browsers. Because Liquid Reality supports the integration of Java and VRML, you can use Liquid Reality to view Java-enhanced VRML worlds that are rich in interaction and animation. Versions of Liquid Reality are available for Windows 95/NT and Sun Solaris.

Figure 3.5 shows the Liquid Reality page at Dimension X's Web site. This page can be found at the URL `http://www.dimensionx.com/products/lr/index.html`. From this page, you can access a wealth of information about Liquid Reality and upcoming enhancements.

Figure 3.5 : Liquid Reality : the marriage of Java and VRML.

## Web Hot Spots for Java Developers

As you explore the Web in search of Java resources, you will quickly discover that Java is the most talked-about programming language on the Web. No other programming language has as many entire sites devoted to it. No other programming language has repositories that list almost everything that's ever been done in the language. No other programming language has attracted the fanfare Java has attracted.

Tip
If you want to actively join in the Java revolution using a newsgroup, the newsgroup you want to look at is `comp.lang.java`, which is a terrific resource for the Java developer community. When you visit the newsgroup, watch the goings on for a few days before participating. This will help you understand the style of the newsgroup.

### Sun's Web Site

Java was conceived by Sun Microsystems, so it seems fitting that your tour of Web hot spots begins with Sun's Web site at `http://www.sun.com/`. Sun maintains one of the top sites on the Web for information relating to client/server computing. The site is largely organized around Sun's monthly magazine, SunWorld, with cover stories, features, and much more.

Figure 3.6 shows Sun's Web site. As you can see, it features a polished and easy-to-use interface that leads directly to the online edition of SunWorld. Although the issues covered in SunWorld relate mostly to client/server computing, this is also a good place to find Java-related articles and industry news. Currently, SunWorld is provided free of charge to online readers.

Figure 3.6 : Sun Microsystems's Web site.

### JavaSoft

JavaSoft's Web site is the best place on the Web to find Java-related information. Figure 3.7 shows JavaSoft's main page at `http://www.javasoft.com/`. All the images on the page are hot links to key areas of the site. As a Java developer, the places you will want to visit often are the What's New? page, the Developers Corner page, and the HotJava Browser page.

Figure 3.7 : JavaSoft's Web site.

The What's New? page is where you will find the latest industry news, including same-day press releases. The Developers Corner page provides the best access to the Java Developer's Kit, full documentation for developers, and extensions to the API (for example, the Java Database Connectivity API). The HotJava Browser page provides information on the latest release of HotJava and allows you to download the browser as well.

### Gamelan

The Gamelan Web site is officially sanctioned by JavaSoft as the repository of Java resources. Gamelan is unlike any other software repository on the Web and can be likened to Yahoo for its pioneering efforts in cataloging networked information.

Note:
Yahoo was one of the first catalog sites on the Web, and this helped it gain name-brand recognition with Web surfers worldwide. Today, despite the fact that there are better catalog sites, Yahoo continues to be one of the most popular catalogs of the Internet.

In the early days, Gamelan was nothing more than a long list of Java resources. Gamelan has since transformed itself into the definitive place on the Web to find everything and anything related to Java-no other programming language in existence has such a wealth of information about it collected in one place.

At the site shown in Figure 3.8, you will find a list of thousands of applets and applications programmed in Java and where they can be found on the Web. You will find a What's New listing of new Java-related resources. You will find a Who's Who list for Java programmers that allows you to tout your skills to the world. You will also find a What's Cool listing of the Java-related resources that are frequently visited from the Gamelan site. The URL to the Gamelan site is

Figure 3.8 : Gamelan: A repository of Java resources.

> `http://www.gamelan.com/`

### JARS

Although the Java Applet Reviewing Service (JARS) is a relative newcomer to the Web, it is my favorite for finding recent innovations in Java applet programming. Figure 3.9 shows the JARS Web site. As the name implies, JARS provides ratings for Java applets that are available on the Web. The top applets rated in any given time period are given awards in the following categories:

Figure 3.9 : JARS: Rating Java applets.

> Top 1% Web Applet
> Top 5% Web Applet
> Top 25% Web Applet
> Top 10 Web Applet
> Top 100 Web Applet

You can search through listings of the top applets directly, by category, or by keyword. You can also find detailed reviews of applets and Java-powered Web pages that have been given the Judge's Pick award. The URL to the Java Applet Reviewing Service site is `http://www.jars.com/`.

## Third-Party Java Tools

Lots of third-party development tools are available for Java. This section focuses on the best of these tools. The speed with which industry giants, like Borland and Symantec, introduced Java development tools speaks volumes about Java's popularity and potential.

### Borland C++ for Java Developers

Borland C++ for Java developers is a cutting-edge development environment for C/C++ and Java. To ease the transition for current C/C++ and Java programmers, Borland integrated its award-winning C++ development environment with Sun's Java Developer's Kit. The result is a graphical development environment that allows you to develop, test, and debug your applications without ever having to use command-line tools.

You can learn more about Borland C++ for Java developers by visiting Borland's Web site at

> `http://www.borland.com`

Figure 3.10 shows a page at the Borland Web site dedicated to Borland C++ for Java developers. Key tools in the developer's kit include the following:

Figure 3.10 : Borland C++ for Java developers.

- Project Manager for Java-Helps you to organize C/C++ and Java source code and to track file dependencies.
- AppAccelerator-A just-in-time compiler for Java that compiles Java code to native code on the fly and increases the performance of Java applications by 5 to 10 times, compared to interpreted Java code.
- AppExpert for Java-Helps you get a fast start on Java projects by generating a custom application based on options you select.
- TargetExpert for Java-Helps with the build process.

### Symantec Café

Symantec Café is an integrated development environment for Java developers who use Windows 95/NT or the Power Mac. Like Borland C++, Symantec Café uses the tools in Sun's Java Developer's Kit as the basis for its graphical development environment. In fact, Café includes the entire release version of the JDK, which provides the Java class library source code and samples.

The integrated environment within which the program operates is called the Café Desktop. The desktop is a customizable interface to all the tools in Symantec Café. Because Café Desktop supports virtual desktop environments, you can access multiple viewing areas at the press of a button. You can learn more about Symantec Café by visiting the Web site shown in Figure 3.11. The URL to this site is `http://www.symantec.com/`.

Figure 3.11 : Symantec Caffe: An intergrated development environment.

### Symantec Espresso and Symantec Caffeine

Symantec Caffeine is a scaled-down version of Symantec Café for Java developers who use a Power Macintosh. As the first development environment for the Macintosh, Symantec Caffeine has a lot going for it. It provides a full-featured project-management system and powerful editing tools that boost productivity. To learn more about Symantec Caffeine, visit Symantec's Web site, shown in Figure 3.12, at the following URL:

Figure 3.12 : Symantec's Web site.

> `http://cafe.symantec.com/caffeine/overview.html`

Symantec Espresso is a scaled-down version of Symantec Café for Java developers who use Windows 95/NT. It also provides a fully featured project-management system and powerful editing tools that will boost your productivity. You can learn more about Symantec Espresso at Symantec's Web site as well.

### Rogue Wave's JFactory

JFactory by Rogue Wave is a graphical development environment designed to speed up the development process. The JFactory home page is shown in Figure 3.13. When you visit Rogue Wave, you should start on the company home page at `http://www.roguewave.com/`.

Figure 3.13 : Jfactory on the Web.

Visual application building and a core set of classes that extend the Java API are what make rapid development in JFactory possible. Although JFactory is limited in functionality as compared to Borland C++ for Java and Symantec Café, it offers a solid development environment without taxing your system. Figure 3.14 shows a sample session in JFactory.

Figure 3.14 : Rogue Wave's Jfactory in action.

### SunSoft's Java Workshop

Java Workshop is the kind of quality product you would expect SunSoft to produce. Figure 3.15 shows the area of Sun's Web site dedicated to Java Workshop at

Figure 3.15 : Java Workshop on the Web.

> `http://www.sun.com:80/sunsoft/Developer-products/java/Workshop/`

With the entire graphical development environment placed within a Webified desktop, Java Workshop is as easy to use as your favorite Web browser and, like your Web browser, all the most-used features are accessible by clicking on an icon. A key feature is the extensive online help that is completely written in HTML format.

For more information on Java Workshop, see Chapter 5, "Java Tools and the JDK: A Primer." You will find an in-depth look at Java Workshop in the section called "Java Workshop: A Graphical Development Toolkit." Figure 3.16 shows Java Workshop's startup window.

Figure 3.16 : Java Workshop in action.

## A Brief Tour of Live Applets on the Web

The best way to see applets is live on the Web. I hope that after reading this chapter and getting a look at what is possible with Java, you will get out your Web browser and join the millions of other Web surfers in search of the ultimate applet.

### Dimension X Café

Dimension X is an outpost in cyberspace for cutting-edge products. One of these products is the Dimension X Café, where you can talk to other cybersurfers live and in real time. Figure 3.17 shows the beginning of a live chat with Dimension X Café. You can access the live chat area from this page at Dimension X: `http://www.dimensionx.com/products/cafe/index.html`.

Figure 3.17 : Live chat in the Dimension X Cafe.

Although the Café has a long way to go before it can be declared the ultimate applet, it certainly is a start on one. By visiting any of the dozens of cybercafés, you can glimpse the Web of the future, where Web surfers will be immersed in real-time interaction.

### WallStreetWeb

The WallStreetWeb applet is shown in Figure 3.18. Not only can the WallStreetWeb applet help you keep tabs on the stock market in real time-it also allows you to track a stock's history and trends at a glance while keeping pace with current data. This applet hints at what is to come as applets with real-time streaming become a part of everyday life on the Web.

Figure 3.18 : Tracking the stock market with WallStreet Web.

To see the WallStreetWeb in action, visit BulletProof's Web site at the following URL:

> `http://www.bulletproof.com/WallStreetWeb/`

### Celebrity Painter

The Celebrity Painter applet, shown in Figure 3.19, is a paint program with a twist. Instead of painting in a specific color, your brush paints with a palette based on a celebrity's picture. This allows you to paint in the hair of one celebrity, the eyes of another celebrity, the nose of another celebrity, and so on for some really comical masterpieces.

Figure 3.19 : Just having fun with Celebrity Painter.

To see Celebrity Painter in action, visit the following home page:

> `http://www.demonsys.com/jorkin/CelebrityPainter`

### DigSim

The DigSim applet, shown in Figure 3.20, is an advanced applet for creating digital simulations based on a set of schematics you can build right in the applet. Although downloading the applet to your system will take several minutes at best, DigSim is well worth the wait if only because every aspect of this feature-rich applet is well thought out and presented.

Figure 3.20 : Advanced simulation with digSim.

To see DigSim in action, visit the following home page:

> `http://www.lookup.com/Homepages/96457/digsim/index.html`

Alternately, you can use this page: `http://www.lookup.com/Homepages/96457/digsim/load.html`.

### 3D Netris

3D Netris from Earth Web is one of a growing number of game applets. (See Figure 3.21.) To say that Web surfers are fascinated by game applets would be an understatement-sites that feature game applets are some of the most visited on the Web.

Figure 3.21 : Earth Web's 3D Netris.

To see 3D Netris in action, visit Earth Web's site at the following URL:

> `http://www.earthweb.com/java/Netris/`

### SGI Java-Powered Home Page

SGI's Java-powered home page is a joy to visit. The most recent version of the home page at

> `http://www.sgi.com/`

contains applets that are used to create menus that activate when you move your mouse over them. As you can see from Figure 3.22, the globes on the left side of the page display submenus. What you cannot see is that the constellation of stars at the top of the screen turn into white dwarfs and that the control buttons at the bottom of the screen glow.

Figure 3.22 : SGI's hot Java-powered home page.

Note:
The SGI Web site is also a good place to find information about advanced graphics development and SGI's high-performance workstations.

### SportsZone

Another hot Java-powered home page is maintained by ESPNET SportsZone. (See Figure 3.23.) One of the best Java enhancements is the live sports ticker applet called ScorePost. This applet lets you see the latest scores and has an interface that allows you to customize the way the scores look.

Figure 3.23 : ESPNET SportsZone on the Web.

A feature attraction at SportsZone is the Fantasy sports games programmed in Java. Because it was baseball season when I visited SportsZone, the Fantasy Baseball applet was available to create my dream team. This applet is shown in Figure 3.24. If you want to play fantasy baseball, visit SportsZone. I hope it will continue to provide access to the free demos long into the future.

Figure 3.24 : The ultimate fantasy baseball game.

When you visit SportsZone on the Web, you should start at `http://espnet.sportszone.com/`.

## Summary

As you start on the journey to become a successful Java developer, you should visit the sites featured in this chapter. The Web has a wealth of Java-related resources to visit, study, and learn from. Navigating the Web is easy if you understand the principles of hypertext linking and URLs. Although hypertext references can be text or graphics based, they are all defined by URLs that specify the path to the resources to be accessed and retrieved. Because the Web provides a common interface to the Internet, you can use any Internet protocol to access and retrieve Web resources.