- Java.lang - Void
- Java.lang - Throwable
- Java.lang - ThreadLocal
- Java.lang - ThreadGroup
- Java.lang - Thread
- Java.lang - System
- Java.lang - StringBuilder
- Java.lang - StringBuffer
- Java.lang - String
- Java.lang - StrictMath
- Java.lang - StackTraceElement
- Java.lang - Short
- Java.lang - SecurityManager
- Java.lang - RuntimePermission
- Java.lang - Runtime
- Java.lang - ProcessBuilder
- Java.lang - Process
- Java.lang - Package
- Java.lang - Object
- Java.lang - Number
- Java.lang - Math
- Java.lang - Long
- Java.lang - Integer
- Java.lang - InheritableThreadLocal
- Java.lang - Float
- Java.lang - Enum
- Java.lang - Double
- Java.lang - Compiler
- Java.lang - ClassLoader
- Java.lang - Class
- Java.lang - Character.UnicodeBlock
- Java.lang - Character.Subset
- Java.lang - Character
- Java.lang - Byte
- Java.lang - Boolean
- Java.lang - Home
Java.lang Package extras
Java.lang Package Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java.lang.ClassLoader Class
Introduction
The java.lang.ClassLoader class is an object that is responsible for loading classes. This class is an abstract class. It may be used by security managers to indicate security domains.
Class Declaration
Following is the declaration for java.lang.ClassLoader class −
pubpc abstract class ClassLoader extends Object
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 |
protected ClassLoader() This creates a new class loader using the ClassLoader returned by the method getSystemClassLoader() as the parent class loader. |
2 |
protected ClassLoader(ClassLoader parent) This creates a new class loader using the specified parent class loader for delegation. |
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method sets the default assertion status for this class loader to false and discards any package defaults or class assertion status settings associated with the class loader. |
2 |
protected Class<?> defineClass(String name, byte[] b, int off, int len) This method converts an array of bytes into an instance of class Class. |
3 |
protected Class<?> defineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain) This method converts an array of bytes into an instance of class Class, with an optional ProtectionDomain |
4 |
protected Class<?> defineClass(String name, ByteBuffer b, ProtectionDomain protectionDomain) This method converts a ByteBuffer into an instance of class Class, with an optional ProtectionDomain. |
5 |
protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) This method defines a package by name in this ClassLoader. |
6 |
protected Class<?> findClass(String name) This method finds the class with the specified binary name. |
7 |
protected String findLibrary(String pbname) This method returns the absolute path name of a native pbrary. |
8 |
protected Class<?> findLoadedClass(String name) This method returns the class with the given binary name if this loader has been recorded by the Java virtual machine as an initiating loader of a class with that binary name. |
9 |
protected URL findResource(String name) This method Finds the resource with the given name. |
10 |
protected Enumeration<URL> findResources(String name) This method returns an enumeration of URL objects representing all the resources with the given name. |
11 |
protected Class<?> findSystemClass(String name) This method finds a class with the specified binary name, loading it if necessary. |
12 |
protected Package getPackage(String name) This method returns a Package that has been defined by this class loader or any of its ancestors. |
13 |
protected Package[] getPackages() This method returns all of the Packages defined by this class loader and its ancestors. |
14 | This method returns the parent class loader for delegation. |
15 | This method finds the resource with the given name. |
16 | This method returns an input stream for reading the specified resource. |
17 |
Enumeration<URL> getResources(String name) This method finds all the resources with the given name. |
18 |
static ClassLoader getSystemClassLoader() This method returns the system class loader for delegation. |
19 | This method find a resource of the specified name from the search path used to load classes. |
20 | This method is open for reading, a resource of the specified name from the search path used to load classes. |
21 |
static Enumeration<URL> getSystemResources(String name) This method finds all resources of the specified name from the search path used to load classes. |
22 |
Class<?> loadClass(String name) This method loads the class with the specified binary name. |
23 |
protected Class<?> loadClass(String name, boolean resolve) This method loads the class with the specified binary name. |
24 |
protected void resolveClass(Class<?> c) This method pnks the specified class. |
25 | This method sets the desired assertion status for the named top-level class in this class loader and any nested classes contained therein. |
26 | This method sets the default assertion status for this class loader. |
27 | This method sets the package default assertion status for the named package. |
28 |
protected void setSigners(Class<?> c, Object[] signers) This method sets the signers of a class. |
Methods inherited
This class inherits methods from the following classes −
java.lang.Object