12.1.1
Load the Class
Test
EXECUTION
will typically start a Java Virtual Machine by invoking method
main
 of class
Test
(a class in an unnamed package), passing it an array containing the four strings
"reboot"
,
"Bob"
,
"Dot"
, and
"Enzo"
.
We now outline the steps the virtual machine may take to execute
Test
, as an
example of the loading, linking, and initialization processes that are described fur 
ther in later sections.
12.1.1   Load the Class
Test
The initial attempt to execute the method
main
 of class
Test
 discovers that the
class
Test
 is not loaded that is, that the virtual machine does not currently con 
tain a binary representation for this class. The virtual machine then uses a class
loader ( 20.14) to attempt to find such a binary representation. If this process
fails, then an error is thrown. This loading process is described further in  12.2.
12.1.2   Link
Test
: Verify, Prepare, (Optionally) Resolve
After
Test
 is loaded, it must be initialized before
main
 can be invoked. And
Test
,
like all (class or interface) types, must be linked before it is initialized. Linking
involves verification, preparation and (optionally) resolution. Linking is described
further in  12.3.
Verification checks that the loaded representation of
Test
 is well formed,
with a proper symbol table. Verification also checks that the code that implements
Test
 obeys the semantic requirements of Java and the Java Virtual Machine. If a
problem is detected during verification, then an error is thrown. Verification is
described further in  12.3.1.
Preparation involves allocation of static storage and any data structures that
are used internally by the virtual machine, such as method tables. If a problem is
detected during preparation, then an error is thrown. Preparation is described fur 
ther in  12.3.2.
Resolution is the process of checking symbolic references from
Test
 to other
classes and interfaces, by loading the other classes and interfaces that are men 
tioned and checking that the references are correct.
The resolution step is optional at the time of initial linkage. An implementa 
tion may resolve symbolic references from a class or interface that is being linked
very early, even to the point of resolving all symbolic references from the classes
and interfaces that are further referenced, recursively. (This resolution may result
in errors from these further loading and linking steps.) This implementation
choice represents one extreme and is similar to the kind of  static  linkage that
has been done for many years in simple implementations of the C language. (In
these implementations, a compiled program is typically represented as an
216






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved