jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes  dynamic class loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark " dynamic class loading" Watch " dynamic class loading" New topic
Author

dynamic class loading

Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

Hi Folks,

What is dynamic class loading in java, please ..if you can show a small example in which we are dynamically loading a class..!! that will be a great help...!!
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Every single class you use is loaded dynamically.

If you want a more detailed answer, you'll have to provide some context.
Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

Jeff Verdegan wrote:Every single class you use is loaded dynamically.

If you want a more detailed answer, you'll have to provide some context.


well if I made a simple class A with system.out.println statement in it...so how does it get dynamically loaded ..please explain in detail what steps go at back end, what instruction does compiler run...? how it is different from class.forname()...? that will be a great help..!! thanks
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Saral Saxena wrote:
Jeff Verdegan wrote:Every single class you use is loaded dynamically.

If you want a more detailed answer, you'll have to provide some context.


well if I made a simple class A with system.out.println statement in it...so how does it get dynamically loaded ..please explain in detail what steps go at back end, what instruction does compiler run...? how it is different from class.forname()...? that will be a great help..!! thanks


The compiler doesn't run any instructions. The JVM does.

If you want to know the general process of class loading, do a web search. I'm sure you'll find plenty. You can also look at the relevant sections of the JLS and JVM spec.
http://docs.oracle.com/javase/specs/jls/se5.0/html/j3TOC.html
http://docs.oracle.com/javase/specs/jvms/se5.0/html/VMSpecTOC.doc.html

After you've spent some time with that research, if you have a more specific question, by all means, ask it here.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: dynamic class loading