Web hosting company - Chapter 3 Introduction to Java Applets 131 ly,

Chapter 3 Introduction to Java Applets 131 ly, there are many different browser versions being used worldwide. Some support only Java 1.0 and many support Java 1.1. However, few support the Java 2 Platform. Also, even the browsers that support Java 1.1 do so inconsistently. In Section 3.6.1, we demonstrate an applet executing in Netscape Navigator 6, which supports Java 2. In Section 3.6.2, we demonstrate how to use the Java Plug-in to execute Java 2 applets in other Web browsers such as Microsoft Internet Explorer or earlier versions of Netscape Navigator. Portability Tip 3.3 Not all Web browsers support Java. Those that do often support different versions and are not always consistent across all platforms. 3.6.1 Viewing Applets in Netscape Navigator 6 When you install Netscape Navigator 6, one of the browser components in the default installation is Java 2. Once installed, you can simply load an applet s HTML file into the browser to execute the applet. You can download and install Netscape 6 from www.netscape.com by clicking the Download button at the top of the Web page. After installing the browser, open the program. On Windows, Netscape 6 typically places an icon on your desktop during the install process. In the File menu, click Open File to select an HTML document from your local computer s hard disk. In the Open File dialog, navigate to the location of the HTML file of Fig. 3.11. Select the file name WelcomeLines.html by clicking it, then click the Open button to open the file in the browser. In a few moments, you should see the applet of Fig. 3.10 appear in the browser window as shown in Fig. 3.14. 3.6.2 Viewing Applets in Other Browsers Using the Java Plug-In If you would like to use the features of the Java 2 platform in an applet and execute that applet in a browser that does not support Java 2, Sun provides the Java Plug-in to bypass a browser s Java support and use a complete version of the Java 2 Runtime Environment (J2RE) that is installed on the user s local computer. If the J2RE does not already exist on the client machine, it can be downloaded and installed dynamically. Performance Tip 3.1 Because of the size of the Java Plug-in, it is difficult and inefficient to download the Plug-in for users with slower Internet connections. For this reason, the Plug-in is ideal for corporate intranets where users are connected to a high-speed network. Once the Plug-in is downloaded, it does not need to be downloaded again. You must indicate in the HTML file containing an applet that the browser should use the Java Plug-in to execute the applet. To do so, requires that you convert the and tags into tags that load the Java Plug-in and execute the applet. Sun provides a conversion utility called the Java Plug-in 1.3 HTML Converter2 that performs the conversion for you. Complete information on downloading and using the Java Plug-in and the HTML Converter are available at the Web site java.sun.com/products/plugin/ Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/2/01

Leave a Reply