| Author |
What does it mean when the class is loaded to JVM?
|
Hanna Habashy
Ranch Hand
Joined: Aug 20, 2003
Posts: 532
|
|
Hi: I know it is not a very smart quistion, but I got a little confused. I want to know what does it mean for a class to be loaded to the JVM. I mean when exactly?? Is it when the class is instanciated, or compiled..?? Thanks
|
SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
|
 |
Jeff Bosch
Ranch Hand
Joined: Jul 30, 2003
Posts: 804
|
|
Hi, Hanna - Classes can't be loaded by the JVM at compile time because the compiler and the JVM are separate programs. You compile your source-code text file into one or more bytecode class files using "javac". Then, you invoke the JVM with "java". The class that you invoke when you run java SomeClass gets loaded first, and the JVM looks for a main() method for starting the program. Other classes are loaded or even pre-loaded (cached) depending on the JVM implementation, which you can influence by writing your own class loaders. Chapter 12 of the Java Language Specification, available for free download from Sun, contains all the gory details and references to the Java Virtual Machine Specification if you crave even more binary gore. Cheers, Jeff
|
Give a man a fish, he'll eat for one day. <br />Teach a man to fish, he'll drink all your beer.<br /> <br />Cheers,<br /> <br />Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
|
 |
 |
|
|
subject: What does it mean when the class is loaded to JVM?
|
|
|