![]() |
|||
![]() ![]() |
![]() |
![]()
|
![]() |
Part 1
|
Objectives
|
STOP: Test Yourself! Before reading this chapter, test yourself to determine how much study time you will need to devote to this section.
Answers are located at the end of the Chapter
Objective
The easiest and cleanest way to describe the relationship between Java and the Java runtime environment is to compare both technologies to the way Velcro functions. For instance, if you want to temporarily mount a pair of speakers onto your computer monitor, you could attach strips of opposing pieces of Velcro to your speakers and computer, and then put the devices together. Using Velcro instead of, say, glue, gives you the ability to move the speakers at will, without any adverse effects. Velcro allows you to attach the speaker to whatever you want to attach it to, as long the object has an opposing piece of Velcro on it.
Just as Velcro requires two pieces to operate, so does Java, as displayed in Figure 1.1. A Java executable, or class file, is the first piece, and the Java runtime environment is the second. You can think of the Java runtime environment as the receptor to which the Java executable bonds. The Java runtime environment binds itself to the specific native platform and provides a shield against any platform-specific issues by eliminating machine-specific issues. This shielding is known as a layer of indirection for the Java executable.
Figure 1.1 Java Velcro Effect.
At the time the executable is handed to the Java runtime environment for execution in the JVM , the application can assume a certain set of predefined functionality. It is up to the JVM to shield the application from any platform-specific dependencies. As long as the platform has a JVM affixed to it, all Java executables are able to run. In this way, the Java application binds to the JVM and the JVM, in turn, binds to the specific platform.
One of the most common oversights in the Java world is to say that Java executables can run on any platform . A more correct statement is that Java applications can run on any platform that has an accessible Java runtime environment. Not all platforms are Java-ready, but the list is growing. The Java runtime environment has been announced as a standard facility for the next generation of operating systems produced by all major vendors. For example, the next release of Windows might contain a Java runtime environment. As long as a Java runtime environment is accessible, the Java executable will run, regardless of platform. Soon there will be no distinction between what is a Java-executable and what is native code.
Previous | Table of Contents | Next |
![]() |
|