File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What does it mean when the class is loaded to JVM? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What does it mean when the class is loaded to JVM?" Watch "What does it mean when the class is loaded to JVM?" New topic
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: 805
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. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What does it mean when the class is loaded to JVM?