File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes jvm lazy loading ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "jvm lazy loading ?" Watch "jvm lazy loading ?" New topic

jvm lazy loading ?

James Clarke
Ranch Hand

Joined: Oct 04, 2004
Posts: 148
Hi all,

Does anyone know what lazy loading is in the jvm sense ?

thanks in advance,

Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Originally posted by James Clarke:
Hi all,

Does anyone know what lazy loading is in the jvm sense ?

thanks in advance,


Dear James,

The JVM must be able to load JVM class files. The JVM class loader loads referenced JVM classes that have not already been linked to the runtime system. Classes are loaded implicitly because:

The initial class file - the class file containing the public static void main(String args[]) method - must be loaded at startup.
Depending on the class policy adopted by the JVM, classes referenced by this initial class can be loaded in either a lazy or eager manner.
An eager class loader loads all the classes comprising the application code at startup. Lazy class loaders wait until the first active use of a class before loading and linking its class file.

The first active use of a class occurs when one of the following occurs:

*An instance of that class is created

*An instance of one of its subclasses is initialized

*One of its static fields is initialized

Certain classes, such as ClassNotFoundException, are loaded implicitly by the JVM to support execution. You may also load classes explicitly using the java.lang.Class.forName() method in the Java API, or through the creation of a user class loader.

The IBM JVM's class resolution is lazy by default. Specifying the command-line option turns on eager class resolution. Lazy class resolution improves startup time of JVMs. For example, the number of classes loaded in a basic Java test reduces from approximately 1500 to approximately 300 with lazy loading.

I hope it makes you clear you.
If any concern then revert me.

The Best way to predict your future is to create it - Every great individual common man
I agree. Here's the link:
subject: jvm lazy loading ?
It's not a secret anymore!