• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamic class loading

 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 203
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic