You can set the class path of the application by -cp flag while compilation/execution.
Java contains following type of class loaders by default:
- Bootstrap class loader: Looks for class files such as java.lang.* in rt.jar
- Extension class loader: Looks for class file in /ext location.
- Application class loader: Looks for class file in the location set by the application.
Class loaders follows delegation model while looking for class file. That is, class loader will delegate the load process to parent class loader, if not found, takes the responsibility to load the requested class.
No comments:
Post a Comment