aspose file tools*
The moose likes Java in General and the fly likes Class Loaders in Java ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Class Loaders in Java ?" Watch "Class Loaders in Java ?" New topic
Author

Class Loaders in Java ?

Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138

Hi,

I want to know about the Class Loaders in java. How many types of class loader available in java ?


Thanks,

Rahul
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Basic explanations can be found by a search for java classloader tutorial. The question of "how many types" doesn't make sense - the answer is "as many as you can think of", because new classloaders can be invented and written by anybody who cares to do so.


Ping & DNS - updated with new look and Ping home screen widget
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
Not a "beginning" question. Moving thread.
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
Hello,

Thanks for reply...

Actually i am expecting something different... according to my opinion there are TWO types of class loader provided by java language designers that is mordial and primordial class loader. But not sure which one used by JVM and User to load classes ?

Just want to confirm the same...

Also, sorry for the replying the same thread here... as i don't know where this question should be discussed so, i post it here in Beginners Section.

Thanks,
Rahul
Rajesh Nagaraju
Ranch Hand

Joined: Nov 27, 2003
Posts: 50
As far as my knowledge goes there are 4 types of class loaders
1> Bootstrap or the primordial -- this loads the standard java classes
2> Extensions -- loads the classes in the ext folder
3> System -- loads the classes from the system class path
4> User defined class loaders
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138

Hi Rajesh,

Thank you very much for solution. I want to know... can we load User defined classes using the primordial class loader and Standard java classes using User Defined Class Loader ? I mean is it permissible ?

Thanks,

Rahul
Masa Saito
Greenhorn

Joined: Jun 08, 2010
Posts: 14
Rahul Nair wrote:
Hi Rajesh,

Thank you very much for solution. I want to know... can we load User defined classes using the primordial class loader and Standard java classes using User Defined Class Loader ? I mean is it permissible ?

In a case like this, you need to write test code. Run it and let the jvm tell you if it is "permissible". If you have trouble writing test code, ask for help again about errors in your test code.

I have a working knowledge of custom classloaders and want to help, but there is no way I will offer any opinions about this without running test code. But I don't want to help enough to write test code some i'm not saying nothing. There are many highly knowledgable people on this forum that have helped me a lot. But, in my opinion, the results of test code trumps everything. The jvm is always correct, and you can ask the jvm if something is "permissible" by running test code.
 
Consider Paul's rocket mass heater.
 
subject: Class Loaders in Java ?
 
Similar Threads
when a user-defined class loader is required??
book on classloaders
class loaders
class loading
Why JVM has 3 class loaders?