Skip to main content.

Web Based Programming Tutorials

Homepage | Forum - Join the forum to discuss anything related to programming! | Programming Resources

Java 1.2 Unleashed

Java 1.2 Unleashed -- Ch 51 -- Java Platforms and Extensions


Java 1.2 Unleashed

Previous chapterNext chapterContents


- 51 -

Java Platforms and Extensions




Java's immense popularity has resulted in its implementation on a variety of operating system platforms, including Solaris, Windows NT, Windows 98, Windows 95, Windows CE 2.0, Linux, Macintosh, and others. Java's omnipresence has made it a platform within a platform. In this chapter, you'll find out about the Java Platform and examine each of its parts. You'll also look at Personal Java and Embedded Java and learn about the Java classes developed by Netscape, Microsoft, and other software vendors. When you finish this chapter, you'll be familiar with the Java Platform and the capabilities provided by its popular extensions.



Operating System Platforms Supporting Java

Java's service mark is "Write Once, Run Anywhere." This is not an overstatement--Java runs on every major operating system platform. Sun's platform of choice is their own Solaris, and Java runs on both the SPARC and Intel x86 versions of it. Next in line is Microsoft Windows. Java runs on Windows NT, Windows 95, Windows 98, and Windows CE 2.0. And with the help of IBM's Applet Development Kit (ADK), it also runs on Windows 3.1. Of course, IBM didn't stop with Windows 3.1. It has ported Java to its AIX, OS/2 Warp, OS/390, and OS/400 operating systems.

Java runs on the Macintosh and on every major brand of UNIX, including the enormously popular Linux. Java also runs on UnixWare, VxWorks, OS9, Inferno, Chorus, BeOS, and RiscOS. JavaPC is currently being developed to allow Java applications to run on DOS.

As you would expect, Java runs on JavaOS. This means that Java will soon be running on hand-held computers and consumer electronic devices. Who knows? It might be in your next TV or toaster!

By definition, Java runs on all network computers.

The Java Platform

Because Java is ubiquitous, it is an operating platform in its own right. But what exactly is the Java Platform? JavaSoft has taken special care to define it.

The Java Platform is the Java Virtual Machine and a portion of the Java API, referred to as the Core API. The Core API is the minimum subset of the Java API that must be supported by the Java Platform. All other Java API classes and interfaces that are not in the Core API are in the Standard Extension API. Three special APIs, PersonalJava, EmbeddedJava, and JavaCard, are subsets of the Core API. Figure 51.1 shows the relationship between the Java Platform, Personal Java, Embedded Java, and Java Card.

FIGURE 51.1. The Java application environments.

Core API

Because the Core API must be supported by all Java Platforms, it is the API to which most Java applications will be written. The Core API is quite extensive. It includes all of the packages of the JDK 1.2, plus other packages that will be added to the next JDK 1.3 release. These packages include the following:

Other APIs that are part of the Standard Extension will be added to the Core after they are widely supported.

Standard Extensions

The Standard Extension API includes all packages that are not part of the Core API. It's not supported on all Java platforms, but it contains the most exciting new API developments. The following Standard Extension API packages are being developed:

JavaSoft is continually adding to its list of new APIs that are being developed. If the preceding list does not quench your thirst for Java, check the Java API Overview and Schedule Web page (http://www.javasoft.com/products/api-overview/index.html) for new developments.

Personal Java

Personal Java has been defined as a subset of the Java Platform for use in consumer electronic devices and mobile computing devices. Examples of Personal Java applications include handheld PCs, set-top Internet boxes, Web phones, and game controllers. Personal Java is designed to be upward-compatible with the Java Platform but still capable of executing in memory-constrained devices. Personal Java includes the JVM, PersonalAWT (a fine-tuned implementation of the Abstract Window Toolkit), and most of the applet, JavaBeans, I/O, networking, language, and utility packages. Optional APIs may be added to tailor Personal Java to specific application environments. Personal Java is capable of running on systems with 2MB of ROM and 1MB of RAM.

Embedded Java

Embedded Java is a subset of the Java Platform that is intended for high-volume embedded devices, such as mobile phones, pagers, printers, copiers, fax machines, medical instruments, and factory automation systems. Embedded Java is upward-compatible with Personal Java. It supports a text-only user interface and a selectable subset of the Java Platform. The Embedded Java API is still under development. Embedded Java is intended to be capable of running on systems with .5MB of ROM and .5MB of RAM.

Java Card

Java Card is a Java API for embedding Java in devices such as smart cards. It allows applications to be written once in Java and run on all smart cards for which the Java Card API has been ported. It also allows multiple applications to run on a single card. The Java Card API is currently in version 2.0. The Java Card API consists of parts of the java.lang package, plus the javacard.framework, javacardx.crypto, javacardx.cryptEnc, and javacardx.framework packages. These packages provide low-level control of smart card devices and provide security encryption and authentication services. Java Card is designed for hardware environments that have at least 16KB of ROM, 8KB of EEPROM, and 256 bytes of RAM.

Java Runtime Environment

The Java Runtime Environment, or JRE, is the implementation of the Java Platform and consists of the JVM, Core APIs, and supporting files. It is the JDK without the JDK tools, associated documentation, and source code. Although the JRE has been ported to many operating system platforms, Sun only distributes the JRE for Win32 (Windows NT, Windows 95, and Windows 98) and Solaris (Sparc and Intel versions). The JRE has been tailored to support languages other than English. It is also distributed with Java-enabled products, such as Netscape Communicator, Microsoft Internet Explorer, and Marimba Castanet Tuner.

Java Performance Enhancements

The Win32 Performance Pack is also distributed by Sun as an extension of the JRE. It includes a Just-In-Time compiler (JIT) that increases the speed of Java applications by a factor of 10. The JIT compiler compiles Java bytecodes into native x86 machine code so that they can execute directly on Intel x86 and Pentium-class processors.

Navigator Classes

Netscape has added its own extensions to the Java Platform for use within the Netscape Navigator. These extensions are referred to as Internet Foundation Classes (IFC). The IFC is an API for developing Web applications that execute within the context of the Netscape browser. The API includes additional graphical user interface (GUI) controls besides those included with the AWT, a multifont text object for developing word processor-like applications, drag-and-drop support, animation support, and other capabilities. The IFC can be downloaded from Netscape at http://developer.netscape.com/library/ifc/index.html.

Netscape intended that the Java Foundation Classes (JFC) would eventually include and replace the IFC. However, this is not the case as of JDK 1.2. Eventually, the JFC will incorporate the IFC into the Java API and develop a common set of GUI interface controls implemented as JavaBeans.

Internet Explorer Classes

Not to be left out, Microsoft has developed its own Java API extensions, referred to as the Application Foundation Classes (AFC). The AFC consists of a set of class libraries that implement GUI controls, multimedia capabilities, and support for Microsoft extract cabinet (CAB) files. CAB files are compressed archive files similar to ZIP files. The AFC consists of the following packages:

The AFC is written entirely in Java and is built on top of the AWT. It is intended to run on all Java platforms. The AFCs are available at http://www.microsoft.com/java/afc/.

Other Class Libraries

A number of vendors offer their class libraries as freeware, shareware, and commercial products. The Gamelan Web site has an excellent directory of these libraries at http://www.developer.com/directories/pages/dir.java.html.

ObjectSpace, Inc. has made their Generic Collection Library for Java (JGL) free for commercial use by Java Developers from its Web Site (http://www.objectspace.com). The JGL contains 11 collection objects (such as lists) used to organize other objects, and 40 algorithms (such as sorting) used to manipulate groups of objects. The JGL is licensed and provided by most major Java tool vendors.

Native Methods

All of the Java API extensions that we've mentioned so far have been pure Java extensions. Although it is technically possible to extend Java using native methods, this approach is not recommended because you lose the platform-independent capability of Java.

There are some special circumstances in which native methods may be an appropriate solution for Java software development. For example, when interfacing Java to legacy systems, it may be necessary to create a Java wrapper around the API of the legacy system that you're attempting to salvage. In this case, you would use native methods to provide the interface with your legacy code. Other reasons to use native methods are based on the absence of appropriate features within the Java API. For example, you may need to access the native NetBEUI or IPX protocols of your operating system. Native methods can be used to wrap a Java interface on these protocols. Chapter 53, "Native Methods," shows how to extend the Java Platform using native methods.

Summary

In this chapter, you learned about the Java Platform and examined each of its parts, as well as the Personal Java, Embedded Java, and Java Card application environments. You looked at the most popular extensions to the Java Platform, including Netscape's Internet Foundation Classes, Microsoft's Application Foundation Classes, and ObjectSpace's JGL. In the next chapter, you'll learn about one of the most promising platforms for Java deployment--JavaOS.


Previous chapterNext chapterContents

© Copyright, Macmillan Computer Publishing. All rights reserved.