请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

BootStrapClassLoader

老师,将自己的 jar 放在JAVA_HOME/lib下,为什么写代码的时候也加载不到这个类,BootStrapClassLoader对加载类有什么要求吗?
可以让BootStrapClassLoader加载自定义的类吗

正在回答 回答被采纳积分+3

插入代码

1回答

翔仔 2020-09-28 01:03:04

同学好,除非改造jvm,否则一般不会碰到BootStrapClassLoader,要用的话可以试试这个哈

The bootstrap class loader is represented as null, e.g. when calling Class.getClassLoader(). This can be fed directly to Class.forName(String,boolean,ClassLoader):

If the parameter loader is null, the class is loaded through the bootstrap class loader.

So, you can try to load a class explicitly through the bootstrap loader using Class.forName(className,true,null) or resolve a class relative to another class’ context using Class.forName(className,true,context.gee,context.gee,context.getClassLoader()) without having to special-case the bootstrap loader.

试试理解下英文:)

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号