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?
Is it possible to take a jar-file that can be added to the endorsed lib and instead add it to the classpath?
Build path is used by the compiler to resolve dependencies and build a project. Classpath is used during runtime when running a project in order to find necessary dependencies. Build path is configured on the Java Build Path property page of a project.
PATH is used by CMD prompt to find binary files. CLASSPATH is used by the compiler and JVM to find library files.
The classpath is always set from a source outside the program itself. Separating this responsibility from the program allows the Java code to reference the classes and packages in an abstract manner, allowing the program to be configured for use on any system.
In Java, classes are loaded as needed while a program runs. The classpath is a list of locations (directory or JAR files) in which the JVM will look for classes to load. If a class to be loaded cannot be found, there will be an error and the program may abort.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With