Java Reference
In-Depth Information
1.17. The Java Platform
The Java programming language is designed to maximize portability.
Many details are specifically defined for all implementations. For ex-
ample, a
double
is a 64-bit
IEEE
754 floating-point number. Many lan-
guages leave precise definitions to particular implementations, making
only general guarantees such as minimum range, or they provide a way
to ask the system what the range is on the current platform.
These portable definitions for the Java programming language are spe-
cific all the way down to the machine language into which code is trans-
lated. Source code is compiled into Java
bytecodes,
which are designed
to be run on a Java
virtual machine.
Bytecodes are a machine language
for an abstract machine, executed by the virtual machine on each sys-
tem that supports the Java programming language.
[2]
Other languages
can also be compiled into Java bytecodes.
[2]
A system can, of course, implement the Java virtual machine in silicon that is, using a special-purpose
chip. This does not affect the portability of the bytecodes; it is just another virtual machine implementa-
tion.
The virtual machine provides a
runtime
system, which provides access to
the virtual machine itself (for example, a way to start the garbage col-
lector) and to the outside world (such as the output stream
System.out
).
The runtime system checks security-sensitive operations with a
security
manager
or
access controller.
The security manager could, for example,
forbid the application to read or write the local disk, or could allow net-
work connections only to particular machines. Exactly what an applica-
tion is allowed to do, is determined by the
security policy
in force when
the application runs.
When classes are loaded into a virtual machine, they will first be checked
by a
verifier
that ensures the bytecodes are properly formed and meet
security and safety guarantees (for example, that the bytecodes never
attempt to use an integer as a reference to gain access to parts of
memory).