Java URLClassLoader and ClassLoader

Source: Internet
Author: User

Difference: In fact, in the two class loader has a little difference, is to be able to load the location of the class storage, from the JDK source is actually URLClassLoader inherited ClassLoader, that is to say URLClassLoader ClassLoader extended a bit , so it can be understood as urlclassloader function to be more points. ClassLoader can only load classes below classpath, and URLClassLoader may load classes under any path. Their inheritance relationship is as follows:

public class URLClassLoader extends Secureclassloader {}public class Secureclassloader extends ClassLoader {}

Write a small example to test:

First create a new file under Classpath and the Webroot folder in the root directory: all called Jay.properties, the content is different to show the difference.

Java URLClassLoader and ClassLoader

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.