Saturday, May 16, 2009

Java Class Loader Architecture

Class loader is one of the main components of the JVM implementation.Since a JVM can have many class loaders and are thus used to provide security and network mobility to Java programs.
The JVM has two types of Class loaders:-


1.Primordial Class Loader:-A Primordial Class loader is the part of JVM implementation.It loads only the Java API classes(not other classes) when we execute our Java programs.


2.Class Loader Objects:-An application can create many class loaders at runtime for loading each and every class which is used in the program.


Following diagram depicts how the Class loader is implemented in JVM.




The classes in the primordial class loader are trusted since they are a part of JVM and Java API.The class loaded in the class loader object are not trusted .


Important:-Trusted classes are more authorized to use the resources of a local machine than untrusted classes.


A class loader is just another object in Java.There is no difference in simple Java objects and class loader object.Since it is a part of Java program you can extend the Java program dynamically at runtime.


How it works??
When a class A refers to a class B,the class B is loaded into the same class loader as class A.Therefore,each class can only see the classes that are in the same name space.A name space has a list of classes loaded in the class loader.This is what we call default access(within same package).The classes loaded by different class loaders cannot access each other unless the application explicitly allows the access.In your program,You can load classes from different sources into class loaders and restrict the interaction between the code loaded from different sources.

Suggested Reading Links:-
Java Architecture
Java Architecture Features and tradeoff's


Other Links:-
Home
Open Your online shop Today for free!!!

0 comments:

About This Blog

This Blog is all about Java and programming.This blog is written by Vaibhav Pandey .He is a Computer Science Graduate .You can contact the author at javatute@gmail.com for any suggestion or Query.You can also contact the author for advertising on this blog.All the material presented here is the property of author and its reproduction in any form is strictly prohibited.

Disclaimer:-Download links provided here are not of author in any means.These are found over the Internet.
Page copy protected against web site content infringement by Copyscape

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP