--- Begin Message ---
It is possible to write a new class loader (derived from URLClassloader) that
can implement a custom (yet unsupported) endorsing mechanism. There is a good
example in a SourceForge project called Transclipse. Transclipse is a Xalan
adapter for Eclipse. I am not sure what state the the current SF version is
in. Late last year, I started working on the project to add Xalan SQL support
and it has turned into a bit more work than I thought, almost complete though.
Anyway, I have used the endorsing mechanism in Eclipse, Java apps & Servlets.

Transclipse allows you to switch what version of Xalan you want to use at 
Runtime,
as well as creating a custom class path and SQL Extension (Named connection 
pools)
support.

-JG

Simon Kitching wrote:

On Tue, 2004-05-25 at 00:53, Marco wrote:

Xalan FAQs say that
"The Sun JDK 1.4 is packaged with an old version (2.2D11) of Xalan-Java. The JDK 1.4 will attempt to use this version instead of any on the classpath. Unfortunately, this causes problems when attempting to use a newer version of Xalan-Java with the Sun JDK 1.4."


And possible solutions are:
- use the Endorsed Standards Override Mechanism (place the xalan.jar, xercesImpl.jar, and xml-apis.jar in the <java-home>\lib\endorsed directory)
- use the -Xbootclasspath java commandline option to prepend the new xalan.jar, xercesImpl.jar, and xml-apis.jar to the boot class path.


But, if I distribute my application as a jar file, I can only include the xalan/xerces jars (distributed with the app) in the class path (using the Class-Path property in the manifest file). How could I override the user preinstalled (old) xalan jar?


There is an additional override mechanism available in Java (documented
in the standard java 1.4 docs). If you pass this option to the JVM on
startup:
-Djava.endorsed.dirs=overrides
then any jars in directory "overrides" take precedence over classes in
the java distribution. I use this very successfully in my application
distributions.


Note however that if you need to support both java1.3 and java1.4, then
you need to ensure that for java1.3, the xalan/xerces jars are in the
classpath in the normal manner, while for java1.4 they are in a
directory that the -Djava.endorsed.dirs can point to. Of course for java
1.3, the -Djava.endorsed.dirs option is simply ignored by the JVM, which
helps simplify things a little.

Xalan team: perhaps this info could be put in the FAQ?

Regards,

Simon



--- End Message ---


Reply via email to