Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class Loaders in Java ?

 
Rahul Nair
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

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


Thanks,

Rahul
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a "beginning" question. Moving thread.
 
Rahul Nair
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic