Difference between classpath and endorsed directory

后端 未结 1 653
醉梦人生
醉梦人生 2020-12-23 15:12

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 classpat

相关标签:
1条回答
  • 2020-12-23 15:47

    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.

    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.

    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.

    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.

    0 讨论(0)
提交回复
热议问题