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 50 -- Java Commerce and JavaCard

Java 1.2 Unleashed


- 50 -

Java Commerce and JavaCard

Java Commerce and JavaCard

Not only is the Web changing the way that we share information, it is also changing the way that we do business. Since the earliest days of the Web, businesses arrived in droves to advertise their wares and set up electronic storefronts. With the omnipresence of business activity throughout the Web, approaches to implementing electronic commerce were eagerly sought. JavaSoft answers the call for a practical approach to electronic commerce with its Java Electronic Commerce Framework (JECF).

In this chapter, you'll be introduced to the JECF and learn about its key components. You'll learn about the JECF architecture and how it supports a multiplicity of electronic commerce protocols. You'll learn about the Commerce API and the services it provides. You'll also learn about the Java Commerce Toolkit and Java Wallet. Finally, you'll learn how the Java Card API is being developed to bring smart cards to electronic commerce. When you finish this chapter, you'll be familiar with the various ways in which Java is being used to support electronic commerce applications.

Java Electronic Commerce Framework

The JECF is a framework for developing products and applications that are used in electronic commerce. This framework was developed by JavaSoft to leverage Java's platform-independence to create secure and reliable software components for carrying out financial transactions.

NOTE: The Java Commerce home page is located at

The JECF consists of an architecture and a set of APIs for implementing electronic commerce solutions. Its architecture consists of the following four layers:

NOTE: Java Commerce cassettes are logical objects, not physical objects.

Figure 50.1 provides an overview of the JECF architecture. The Java Environment and Java Commerce Layers provide the foundation for implementing electronic commerce. These layers consist of the classes and interfaces from which cassettes are built.

FIGURE 50.1. The JECF architecture.

The JECF provides a flexible framework for the development of electronic commerce applications. Instead of limiting itself to a particular payment protocol, the JECF allows standard and custom payment protocols to be implemented in terms of cassettes.

Cassettes are used as the building blocks for developing electronic commerce services. Some, but not all, of these services may be presented to consumers, businesses, and other organizations in the form of Java applets. Other cassettes may be embedded in standalone applications. Applets will provide attractive, easy-to-use interfaces to their customers and will use cassettes to carry out commerce transactions. For example, a shopping applet may use a number of alternative cassettes to support credit card payments, electronic checks, or electronic cash.

The Java Commerce API

The Java Commerce API provides the classes and interfaces for building commerce applications within the JECF. These APIs are implemented within the Java Commerce Package Layer of the JECF architecture and support a number of capabilities, including the following:

At the time this chapter was written, the Java Commerce API was in the Alpha 0.8 release and consisted of the following packages:

These packages make use of other packages of the Java Commerce Package Layer, such as those of the Security API.

The Java Commerce Toolkit

The Java Commerce Toolkit is a set of tools for developing electronic commerce applications using the Java Commerce API. You can use it to quickly get a commerce application off the ground. It includes the Java Wallet, sample Java cassettes, and a sample shopping cart applet.

The cassettes implement common electronic commerce protocols. The shopping cart applet is used by customers to hold items to be purchased while browsing through an electronic store. The Java Wallet is covered in the next section.

Java Wallet

The Java Wallet provides GUI controls that are used to carry out financial transactions. These GUI controls are designed to provide a graphical representation of a traditional wallet. Figure 50.2 provides a screen capture of the Java Wallet interface.

Figure 50.2. The Java Wallet.

The purpose of the Java Wallet is to make users comfortable using electronic commerce applications. The Java Wallet interfaces with cassettes that carry out electronic commerce protocols. It's extensible and can support a number of different cassettes. It was also designed with financial institutions in mind. It provides institutions with the capability to tailor the wallet to display institution-specific information, such as logos and address information, in a manner similar to credit cards, such as Master Card and Visa.

The Java Wallet is not tied to any particular implementation. It is written in pure Java and will run on all platforms that support the Commerce API.

The Java Card API

The Java Card API is designed for creating specialized applications that run on smart cards. A smart card is the size, shape, and appearance of a normal credit card. The difference is that it has a small programmable computer embedded within it that contains memory and is capable of storing a limited amount of information. The availability and use of smart cards are expected to grow tremendously in the next few years.

The Java Card API was developed to program smart cards. It is a specialized API, in that it runs on a limited version of the JVM that is designed for the tight constraints of a smart card.

The Java Card API is compliant with ISO 7816-4. This means that it will run on any standard smart card. The Java Card API can be used to program smart cards for a variety of applications, such as identification and authentication, storage of medical information, and, of course, electronic commerce. The Java Card API is intended to provide a smart card implementation of the Java Wallet.

The Java Card API consists of a single java.iso7816 package that is based on the ISO 7816-4 standard ( This package provides very low-level methods for controlling smart card operation.


In this chapter, you were introduced to the JECF and learned about its key components. You learned about the JECF architecture and how it uses cassettes to support a range of electronic commerce protocols. You learned about the Commerce API and about the services it provides. You also learned about the Java Commerce Toolkit and Java Wallet. Finally, you learned about how the Java Card API is being used to implement electronic commerce with smart cards. In the next chapter, you'll learn about the variety of execution platforms that support Java.


© Copyright 1998, Macmillan Publishing. All rights reserved.