classpath和endorsed目录之间的区别 [英] Difference between classpath and endorsed directory

查看:138
本文介绍了classpath和endorsed目录之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道将适当的JAR文件(例如Apache XALAN)添加到JRE的背书目录并将其添加到应用程序的类路径之间有什么区别?

Does anyone know what the difference is between adding an appropriate JAR-file (eg. Apache XALAN) to a JRE's endorsed directory and adding it to the application's classpath?

是否可以获取可以添加到已认可的lib的jar文件,而是将其添加到类路径中?

Is it possible to take a jar-file that can be added to the endorsed lib and instead add it to the classpath?

推荐答案

技术上你可以做到这一点,但区别在于endorsed目录中的jar文件是由bootstrap类加载器加载的,它可能与从类路径加载jar的类加载器不同。

Tecnically you probaly can do that, but the difference is that the jar files in the endorsed directory are loaded by the bootstrap classloader, which is probably not the same classloader as the one that loads your jars from the classpath.

Xerces和Xalan XML实现中存在一个经典的XML问题在背书目录中。因为较新的应用程序有时需要两个库的较新版本,并且类具有相同的名称,所以存在类路径问题。

There is a classic XML problem with the Xerces and Xalan XML implementations which are out in the endorsed directory. Because newer applications sometimes require newer versions of both libraries, and the classes have the same names, there is a classpath problem.

您可以替换Xerces和Xalan库中的支持dir(备份你的旧版本!)但这可能搞砸了使用相同JRE安装的其他应用程序。

You can replace the Xerces and Xalan libraries in the endorsed dir (backup your old ones!) but that can possibly screw up other applications which use the same JRE installation.

我甚至在1个应用程序中看到了这个问题一个库依赖于一个版本,另一个库依赖于另一个版本的xerces。非常麻烦,并且没有一般方法,或者至少没有我找到的。

I've even seen this problem within 1 application where one library depends on one version, and another library depends on another version of xerces. Very troublesome, and there's no "general approach" to this, or at least none that I found.

谷歌有一些有趣的文章可以在此找到,尝试找到一个最符合你的情况或问题的。

There are some interesting articles easily found by Google on this, try to find one which best matches your situation or problem.

这篇关于classpath和endorsed目录之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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