Java Reference
In-Depth Information
You can clearly see the different *.jar iles
that will be considered ( charsets.jar ,
deploy.jar , and so on).
The extensions class loader loads the
classes from the extensions directory
<JAVA_HOME>/jre/lib/ext . Figure 2-4
shows the contents of the extensions direc-
tory in a JRE7 environment.
Again, you can clearly see the different
JAR files available: access-bridge-64.
jar , localedata.jar , and so on.
figure 2-4  
Finally, the system class loader loads the code from
the locations specified in the CLASSPATH environment
variable, which is defined by the operating system.
The latter provides the path to all physical directories
where the system class loader can look for Java files.
It can be found in Windows 7 and Windows 8 by
going to the Control Panel System and Security
System, Advanced System Settings Advanced tab
Environment Variables. Figure 2-5 shows the window
from a Windows 7 operating system, but Windows 8
looks very much the same.
Bytecode Veriier
The bytecode verifier checks to make sure the byte-
codes are valid without breaching any of Java's secu-
rity rules. It pays special attention to type checking all
the variables and expressions in the code and ensures
that there is no unauthorized access to memory. Note
that when a Java program is invoked, you can choose to disable the bytecode verifier (which will
make it run slightly faster), enable it only for code that was downloaded remotely from the network,
or enable it for all the code. Once the code is verified, it will be offered to the Java Virtual Machine
(JVM) for interpretation.
figure 2-5  
Java Virtual Machine (JVM)
The Java Virtual Machine (JVM) can be considered an abstract computer machine capable of execut-
ing bytecode on a particular hardware platform. It constitutes the heart of the “write once, run every-
where” philosophy. Various JVM implementations have been provided for various hardware and/or
operating system environments. The most popular JVM is HotSpot produced by Oracle. It is available
for Windows, Linux, Solaris, and Mac OS X. A key component of the JVM is the interpreter respon-
sible for interpreting the bytecode instructions. The garbage collector cleans up unused memory to
improve the efficiency of the program. The JVM typically also includes facilities for multithreading
and synchronization, whereby a Java program can be executed in one or more parallel execution paths
(threads) scheduled on one or more CPUs, hereby significantly accelerating its execution time.
 
Search WWH ::




Custom Search