Previous Page TOC Next Page


— 3 —
Java Browsers

In order to view Java applets, either a Java-capable browser or an application specifically written to run applets is required. Three programs currently fall into this category:

This chapter explores the capabilities and restrictions of all three of these Java environments. Java allows a great deal of latitude in deciding how much extensibility and security is necessary, and each of these programs takes a different approach.

HotJava

When Sun decided to target Java at the World Wide Web through applets, it needed a Java-capable Web browser as a prototype to work with. This prototype was necessary to prove that Sun's hope of being able to run programs in Web pages was a realistic possibility. HotJava was the result and became a surprisingly good browser (see Figure 3.1).

Figure 3.1. The HotJava browser.

Java's Java Browser

One of the most impressive things about HotJava is the fact that it is almost entirely written in Java. Java has a somewhat undeserved reputation for being slow and limited in its capabilities. HotJava shows that Java is more than capable of producing high-quality applications that run reasonably well.

For the most part, HotJava looks and functions much like a typical Web browser. It has most of the expected features that other modern browsers have, such as hotlists, the ability to show sources, and the ability to set up proxies. For a browser originally meant solely as a showcase for Java, HotJava is surprisingly usable for general Web browsing.

HotJava is meant to display Java applets, and that area is where it really shines (see Figure 3.2). Most other Java browsers give the impression that Java was tacked on as an afterthought, but HotJava was built around Java from the beginning—and it shows. HotJava starts up quickly and runs applets more smoothly than other browsers.

Figure 3.2. HotJava running a Java applet.

Feature-Rich and Flexible

HotJava is special because it sees Java not just as a way to run applets inside a Web browser; it aims to make the core browser much simpler by not having much built into it and having the browser download new "intelligence" when necessary. This design makes HotJava much more flexible than other browsers because it makes the browser itself very simple and open to change.

How is this flexibility achieved? In addition to applets, which HotJava refers to as Interactive Content, HotJava also contains two other innovations: dynamic content types and protocols.

Dynamic Content Types and Protocols

Most Web browsers directly support a limited number ways to communicate over the network and file types that they understand. Moreover, most browsers' capabilities are set in stone from the beginning( see Figure 3.3), much like an all-in-one stereo system that has features you like, but no way to add new ones. Unfortunately, this means that when one browser starts supporting a new type before others there is a period of time when other browsers do not support that type.

This kind of situation occurred when Netscape Navigator started supporting inline JPEG files before other browsers of the time (such as Mosaic). Before this time, people needed an external viewer to view a JPEG picture. Because Navigator was so popular, many people started using inline JPEGs, which would show up as broken links on browsers other than Netscape Navigator.

Figure 3.3. Most browsers have a fixed amount of functionality.

HotJava is more like a component stereo system where pieces can be attached and detached at will. HotJava aims to make sure that users never have to upgrade their browsers again just to support a new capability. When HotJava encounters a content type (picture, animation, and so on) or protocol (a way to transmit information) that it doesn't understand, it reconfigures itself to be able to work with that type (see Figure 3.4). HotJava reconfigures itself by first scanning the page it just received to find out whether the page contains anything that it cannot understand. If the page does contain something that's not understandable, HotJava then asks whether the server has the Java code to enable it to decode the content it does not understand. If the server does have the code, HotJava downloads it and integrates it to add this functionality.

When it comes to the Web (and any technology in general), predicting the future is difficult, but you can be sure of one thing: there will always be new protocols and content types. HotJava adapts itself to these changes instead of forcing users to repeatedly install new versions of the software.

Figure 3.4. HotJava can reconfigure itself to handle new functionality.

Configuration

One drawback to HotJava is that although it's very good at reconfiguring itself to respond to new and changing environments, it doesn't have a tremendous amount of configurability from the user's perspective.

The basics are available (see Figure 3.5); users can define proxies and default write and read directories on the hard drive. Most importantly, users can delay images or applets from loading if they are running HotJava over a slow network link. Unfortunately, many of the configuration options that are normally expected are missing, such as the capability to modify the appearance of the screen by changing fonts and colors and the capability to control how links are displayed.

This overall lack of configurability is a huge drawback compared to other browsers. Netscape Navigator, for instance, lets you configure almost every aspect of the way it works, even down to what colors to show Web links in. For HotJava to ever be considered a serious browser, it needs major improvements in this area.

Figure 3.5. Configuring HotJava.

Security

One of the main issues with security in Java is what machines an applet should be able to connect to in order to transmit and receive information. Many Java applets will involve some sort of communication with other machines on the Internet. If an applet were allowed to communicate with any machine it wanted to, major security problems would result.

Still, it is often desirable to allow an applet to communicate with other machines. For instance, if you had a stock ticker applet that displayed current stock prices, it would make sense to allow it to check back for updated prices on a regular basis.

HotJava allows users to specify which machines(also called hosts) the applet can communicate with. The user can select one of four options (Figure 3.6):

For most situations, the Applet Host option makes the most sense. However, if you have serious concerns about security, make No Access the standard choice and make exceptions when needed. For example, if you are running Java applets inside of a corporation, you might have concerns about a rogue applet somehow transmitting sensitive information outside of the company. To ensure that this situation doesn't happen, you might choose the No Access option so applets cannot contact any hosts at all.

In any circumstance, think carefully before allowing the applet Unrestricted access to any other machine on the network. This means that the entire Internet is wide open to connect to whatever the applet wishes.

Figure 3.6. Setting security options in HotJava.

Sun's Commitment to HotJava

HotJava was the centerpiece of Sun's promotion of Java for quite a while and until early Fall 1995 was synonymous with Java. It was generally accepted that HotJava was the platform on which the majority of applets would run. Shortly after Sun moved from the Alpha version to the Beta 1 version of Java, however, Netscape released a version of their browser that supported Java as well. Unfortunately, Sun did not release another version of HotJava through the entire beta test of Java, nor had it been updated by the time of the official 1.0 release of Java. This situation is especially unfortunate because the version of HotJava available as of this writing will not execute current applets, only those written in the older Alpha version of the language.

Since Netscape has taken the lead in writing browsers that are Java-capable, Sun seems to have decided to focus its energies elsewhere. Although this change in focus is understandable, it is also unfortunate as HotJava was quite promising. Hopefully, Sun will continue developing HotJava, but for now it seems to have been relegated to obscurity.

Availability

HotJava is available via FTP at ftp.javasoft.com in the /pub directory. There are currently versions available for Windows 95, Windows NT, and Solaris 2.x.

appletviewer

The appletviewer, included in the Java Developer's Kit, is the bare-bones way to run and test applets (see Figure 3.7). It makes no pretense of trying to be a browser; all it does is run applets. That said, you may be wondering why you would ever need to use the appletviewer instead of Netscape Navigator or another Java-capable browser. Well, there are two circumstances in which the appletviewer is a useful tool: applet development and standards testing.

Figure 3.7. The Java Developer's Kit's appletviewer.

First, when developing applets, the amount of time required to start up the appletviewer is much less than the time required to launch a full-featured browser. During development, you might want to test your applet many times, and the time saved by using the appletviewer can be substantial.

Second, it always makes sense to check your applets with the appletviewer to make sure that they are compatible with standard Java. In a perfect world, all versions of Java would be identical, but as more and more companies integrate Java into their products, there is bound to be some deviation. Using the appletviewer ensures that you are not relying on one of those deviations.

Special Capabilities

As mentioned before, the appletviewer is pretty basic. However, it does have one very nice feature. By selecting Tag in the Applet menu, you can get the correct <APPLET> tag for the running applet, even after resizing the applet (see Figure 3.8). This feature is invaluable when you're trying to figure out how large to make your applets. The <APPLET> tag is discussed in detail in Chapter 6.

Figure 3.8. Getting the HTML tag for an applet.

The appletviewer also can reload an applet as if it were being loaded for the first time, whereas most Java-capable browsers only allow the applet to be started and stopped.

Configuration

You can set four properties in the appletviewer: the HTTP proxy server, the firewall proxy server, the applet's ability to connect to hosts, and the applet's ability to access other areas of Java code. To change these properties, select Properties from the Applet menu (see Figure 3.9).

Figure 3.9. Configuring appletviewer.

Security

The appletviewer has a security setup very similar to HotJava, with one exception. The appletviewer omits the option that allows applets to connect only to hosts that are outside the firewall, although the appletviewer does allow configuration to work behind a firewall.

Availability

The appletviewer is included with the Java Developer's Kit (see Chapter 7, "The Java Developer's Kit").

Netscape Navigator

Although there is a bit of sorrow at Sun's apparent neglect of HotJava, the amount of credibility that Netscape's licensing of Java in August 1995 gave to Java is almost incalculable. Until then, Java had been generally seen as an interesting sideshow, but the integration of Java into Netscape Navigator placed it firmly in the Web mainstream.

Netscape Navigator 2.0 (see Figure 3.10), released in February 1996, is the first version to support Java. It went through a public beta test for several months and appears to be quite stable. It is unquestionably the most feature-rich browser currently available. In addition to providing support for Java, it integrates support for JavaScript (see Appendix B), a general standard for Plug-Ins (programs that extend the functionality of Navigator), and the addition of frames (which allow the main browser window to be split into multiple partitions).

Figure 3.10. The Netscape Navigator browser.

Unlike HotJava, which was designed around Java from the very beginning, Java support was integrated into Navigator after it was already a solid and shipping product. Thus, Java doesn't feel quite as integral to Navigator as it does in HotJava. (For example, Navigator lacks HotJava's ability to automatic reconfigure itself to handle new types of content.) However, this seems to be a small price to pay to have Java alongside all of Navigator's other numerous capabilities.

Also, Netscape has clearly taken a major role in the ongoing development on Java. The JavaScript scripting language was originally developed by Netscape under the name LiveScript and was later renamed and jointly released by Sun and Netscape. It seems that the leading proponent of Java outside of Sun will be Netscape for the foreseeable future, and that Navigator should stay at the forefront of Java-capable browsers.

JavaScript is a simple scripting language that allows small programs to be added within a Web page (see Figure 3.11). Although similar in purpose to Java, JavaScript is meant for smaller tasks such as validating that correct information was entered into a form (by making sure that numbers instead of characters are entered into a form that expects numbers, for example). Eventually, JavaScript will be able to directly control Java applets and make them work together, but this capability is not available in version 2.0 of Navigator.

Figure 3.11. A JavaScript program.

Special Capabilities

Navigator attempts to seamlessly add basic support for Java applets into Web pages and does an admirable job. While applets are loading, a light gray box indicates where the applet will appear, and a report of the applets starting and stopping appears in the status bar (see Figure 3.12).

Figure 3.12. Netscape loading an applet.

If you want to see any information that the applet may be sending to the Java Console (things like debugging data, information on the current state of the applet, and so on), choose the Show Java Console command under the Options menu. This command displays a window that shows any console output (see Figure 3.13). The Java Console allows programs to output simple text for debugging information. This capability is important because applets are by their nature graphic and it would be difficult to relay this information any other way.

Figure 3.13. Netscape's Java Console.

Although Navigator does not include many of the automatic integration features of HotJava, it does have support for most current protocols, and version 2.0 has added support for electronic mail and a much improved Usenet newsreader. With the addition of all these features, the ability of a browser to reconfigure itself seems less important. Moreover, Netscape has conditioned users to upgrade their browser to the new version on a regular basis anyway, to the point where many people see it as a normal and expected occurrence.

Netscape did not attempt to add many additional special Java-related capabilities to Navigator, and in many ways this a good thing. Java is seamlessly integrated into Navigator—you don't even know it is there until an applet appears.

However, one new capability that has been announced is enabling JavaScript to be able to use Java applets. Because JavaScript is much simpler than Java, this capability will let people who do not have the time to learn Java use applets that have already been written by scripting them. For instance, a JavaScript script could use a Java applet that lets you pick a style of a car and then give the price of the car. This capability would be advantageous because learning to program Java is nontrivial, whereas JavaScript has been designed to be programmed by the end user. Although not available in version 2.0, the capability to script applets has been announced for the next release of Navigator.

Imposing New Standards

Even before Netscape adopted Java, it contributed a great deal to the advancement of the World Wide Web. Netscape has been on the leading edge of adding new features to its browser and has contributed extensions to HTML. For instance, Netscape was responsible for bringing both tables and frames to the Web, which are two of the most appreciated additions to HTML. Unfortunately, there is also a growing sense that Netscape feels free to do things in a proprietary manner in order to make its browser more attractive to users. This strategy has worked well for Netscape, but there is always the danger that it will go too far.

Up to this point, Netscape has remained pretty faithful to the Java standard without adding functionality that applets can access only on the Netscape browser. If this fact changes in the future, you may see Java applets that have messages next to them stating, "Works best with Netscape Navigator," as seen in many current Web pages. For better or for worse, Netscape Navigator is the standard on the Web and is the default choice for anyone that wants to browse the Web.

Configuration

Netscape Navigator is easily the most configurable of any current browser; it allows users to configure almost every aspect of the browser. For example, users can fine-tune how pages are displayed, including the language to display them in. Four distinct areas are customizable in Netscape Navigator through their respective menu items:

Figure 3.14. Netscape General Preferences dialog box.

Figure 3.15. Netscape's Mail & News Preferences dialog box.

Figure 3.16. Netscape's Network Preferences dialog box.

Figure 3.17. Netscape's Security Preferences dialog box.

Security

Netscape has prided itself on security for quite a while. When Netscape announced Java would be integrated into Navigator, there was a great deal of concern that Java would cause security problems. Netscape has gone to great pains to make sure that doesn't happen by limiting what applets are allowed to do.

Unlike HotJava, where the user can choose a variety of Java applet security modes, Navigator 2.0 only has one option: disable or enable Java (see Figure 3.17). Note that there is no way to set what machines an applet is allowed to communicate with. Navigator allows an applet to communicate only with the server that the applet was downloaded from (the HTML server that provided the page on which the applet resides).

Unlike HotJava, you cannot setup Netscape Navigator to only connect to machines outside your firewall. More importantly, you cannot configure Navigator to not allow applets to communicate with other machines at all. With Navigator, Java is an all or nothing proposition. This is expected to change in later versions of Navigator, but Netscape has not outlined how exactly this will change.

Netscape Navigator has another level of built-in security called Secure Sockets Layer(or SSL). SSL is a way for Web sites to ensure that the communication that has transpired between the Web site and your machine has not been tampered with. Netscape has been a leader in this area, mainly due to the desire to facilitate electronic commerce.

Availability

Netscape Navigator is available via FTP at ftp.netscape.com in the /pub/2.0 directory (the most current version can always be found in /pub/netscape). Java-capable versions are available for the following platforms:

Windows 95

Windows NT

Solaris 2

Dec Alpha OSF2

HP PA-Risc HPUX

Linux

386BSD

SGI Irix

IBM AIX

SunOS 4


Versions without Java are currently available for Windows 3.1 and Apple Macintosh, but Java-capable versions for these products should be available in the near future.

Summary

This chapter discussed all the currently available ways to view Java applets. HotJava holds a great deal of promise, but it seems as though Sun has lost interest in it. The appletviewer is really only useful for development in Java. Netscape Navigator currently holds the distinction of being the most useful Java-enabled Web browser. Its high level of configurability and numerous features make it the obvious choice.

This status could change, however, in the not too distant future. Microsoft has recently challenged Netscape's dominance of the Web browser market with the release of its Internet Explorer. In December 1995, Microsoft announced an intent to license Java, fueling speculation that they would soon be incorporating it into their browser. In addition, Spyglass, a company that provides Web browser technology for over 45 companies who embed the technology in more than 120 products, has licensed Java. These developments should make the Java-enabled Web browser market very interesting for a long time to come.

Previous Page TOC Next Page