This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

What is ClassLoader

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just wanted to understand what is java.lang.Class object and how does it work i am having problem to work with becouse i am not understanding the concept behind this
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A ClassLoader is an object that is responsible for loading *.class files and turning them into classes that the JVM can use.

See the API documentation of class ClassLoader, it explains it in more detail.

Google for "java classloader" and you'll find some documents that go deeper into the concept of classloaders.
 
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since a classLoader object is an object of type ClassLoader, how does a classLoader get loaded?
 
author
Posts: 23868
141
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Kaydell Leavitt:
Since a classLoader object is an object of type ClassLoader, how does a classLoader get loaded?



If memory serves, there is a bootstrap class loader, in the JVM. This class loader is responsible for loading the runtime classes. In these classes is another classloader that is responsible for loading the classes from the classpath.

And if you intend to write your own classloader, so that you can load classes from another source, you are supposed to place your classloader in the classpath.

Henry
 
vijay shanker
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Henry Wong:


If memory serves, there is a bootstrap class loader, in the JVM. This class loader is responsible for loading the runtime classes. In these classes is another classloader that is responsible for loading the classes from the classpath.

And if you intend to write your own classloader, so that you can load classes from another source, you are supposed to place your classloader in the classpath.

Henry




But what does it mean when you say "load the classes". is this same as making an object of class that will be available to program to call methods
of that class.
 
Henry Wong
author
Posts: 23868
141
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by vijay shanker:

But what does it mean when you say "load the classes". is this same as making an object of class that will be available to program to call methods
of that class.



If you wamt to write your own class loader, please google for information on how to do this.... basically... the class loader will load the bytecodes (the class file). Once the class loader has the byte codes in a byte array, it will call a method called defineClass(), which does all the stuff need by Java -- including creating the Class object.

It also does other stuff, which is why I recommend that you google for more information, if you are interested.

Henry
 
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!