URLClassLoader.addURL(URL)是否遵守META-INF / MANIFEST.MF [英] Does URLClassLoader.addURL(URL) honor the META-INF/MANIFEST.MF

查看:753
本文介绍了URLClassLoader.addURL(URL)是否遵守META-INF / MANIFEST.MF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的jar包含 MANIFEST.MF 中的Class-Path条目。如果我将jar添加到 URLClassLoader ,那么 Class-Path 条目中的jar也会添加到类加载器?我是否需要内省我想要添加到类加载器的jar来检测它并为每个jar调用 addURL 它们(递归地)?

If I have a jar that includes a Class-Path entry in the MANIFEST.MF. If I add the jar to a URLClassLoader, are the jars in the Class-Path entry also added to the classloader? Do I need to introspect the jars that I want to add to the classloader to detect this and call addURL for each of them (recursively)?

推荐答案

它根据sun.misc.URLClassPath的源代码从JDK 1.6开始,但它没有指定,所以请选择; - )

It does as of JDK 1.6 according to the source code of sun.misc.URLClassPath, but it isn't specified, so take your pick ;-)

这篇关于URLClassLoader.addURL(URL)是否遵守META-INF / MANIFEST.MF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆