How to use jaxp 3 with jdk 1.6?
Posted
by Michal
on Stack Overflow
See other posts from Stack Overflow
or by Michal
Published on 2010-05-13T13:15:03Z
Indexed on
2010/05/13
13:24 UTC
Read the original article
Hit count: 432
I'm trying to migrate application from jdk 1.5 to jdk 1.6 without introducing any changes visible to the end user. Application's output is an xml generated using jaxp which is a part of the jdk libraries. Since jaxp versions are different in jdk 1.5 and 1.6, the resulting xml looks different in each version.
An example: DatatypeFatory.newInstance().newDuration(60)
produces 'PT2H17M0.000S' in jdk 1.5 and 'P0Y0M0DT2H17M0.000S' in jdk 1.6. Both are correct, but i want to avoid any visible changes.
Classes like DatatypeFactory have a mechanism which allows specifying which implementation should be used, but it relies on specifying full qualified class name. So theoretically i could download jaxp jars with the same version which is used in jdk 1.5 and let the application use them. Unfortunately the package and class names are the same in both versions, so i would have to somehow tell java to load classes from jar and not jdk. I was trying to put jaxp jars at the beginning of the classpath, but it didn't help.
Is it possible to tell java to load classes from external jar and not jdk libraries? Can i solve this problem in any other way?
Thanks in advance
© Stack Overflow or respective owner