Coder Social home page Coder Social logo

Comments (4)

whdalive avatar whdalive commented on May 21, 2024 1

@kennywgx
换个角度解释,默认下 BootStrapClassLoader、ExtClassLoader、AppClassLoader都是加载指定路径下的jar包,比如AppClassLoader加载的是当前 classpath 下的类,核心在于加载的资源路径。
如果此时你想加载磁盘某个位置或者网络中的某个类,那么你就需要自己定义一个ClassLoader 来加载特定路径。
以上,粗略理解,有误还请指出。

from jcsprout.

crossoverJie avatar crossoverJie commented on May 21, 2024

@kennywgx

通常是自定义的类父类不会加载,比如你定义一个 Person.java ,但如果你定义了一个 java.lang.Integer 那肯定是父类优先给你加载了。

from jcsprout.

kennywgx avatar kennywgx commented on May 21, 2024

@crossoverJie 哈哈哈你这样说我更懵了,你意思是我定义一个MyInteger继承java.lang.Integer类吗?然后Integer先帮我加载一个Integer.class丢给MyInteger的类加载器?
另外我定义一个简单Person类的话,他的父类应该是Object吧,Object类加载器返回不能加载,然后Person类加载器再加载Person类,吗?

from jcsprout.

devpage avatar devpage commented on May 21, 2024

我来回答一下。在你项目运行过程中,当需要某个类的时候,恰好在当前cladspath下 你当前jvm中的各类classloader都拿不到某个类的时,你就需要自己搞一个classloader来做娄底方案了,听懂了没有

from jcsprout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.