• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class loader

 
hemant nayak
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all, i am a bit confused about class loader and its function. i think class loader loads java class for execution(hope i am right).But then what is a class loader ---- is it comes with uderlying operating system or it comes with java virtual machine.Thank u....
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

A class loader is any Java class that extends java.lang.ClassLoader. The job of a class loader is to find the data that defines a class -- i.e., read it out of a *.jar or *.class file -- and call a special method in java.lang.ClassLoader which turns that data into a Class in the JVM. That special method is a native method -- one whose code is actually written in C or assembly language. If you have some interesting new way to store class file data, it's pretty easy to write your own class loader.

A JVM has to come with a special "bootstrap" class loader so that it can load the very first class files. This primordial class loader is written all in C or assembly, and it calls that native method's C implementation directly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic