File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes No need for Xerces since Sun includes it in the jvm? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "No need for Xerces since Sun includes it in the jvm?" Watch "No need for Xerces since Sun includes it in the jvm?" New topic

No need for Xerces since Sun includes it in the jvm?

Riffle Chris

Joined: Feb 18, 2009
Posts: 27

Hey Everybody,

If one would like to use Xerces in a java app, why should they download it from Apache when it's included in Sun's jvm releases as of 1.4?

I noticed that the "rt.jar" in Sun's jvm for Windows contains an apache folder: jdk1.6.0_11\jre\lib\rt.jar\com\sun\org\apache\,
that contains the following apache folders: bcel, regexp, xalan, xerces, xml, xpath

How does one tell what version of Xerces is being released with a particular Sun jvm release? I looked all over the Sun site - it seems they haven't documented that they are using files from Xerces. They even took the trouble of burying the "org/apache" folder down under the "com/sun" folder -- as if to hide the fact that apache is being used....maybe to take credit for it to make it look like the functionality was developed by Sun? hmmm

Is there a chance that one could successfully compile java code that has references to Xerces classes where the developer's project does not contain Xerces jars, but instead relies on the Sun bundled xerces classes -- and while that code would compile file, there could exist runtime exceptions due to potential classes from Xerces that Sun did not include in its jvm -- while if the project did include the Xerces jars - there would be no runtime errors?

Carey Evans
Ranch Hand

Joined: May 27, 2008
Posts: 225

The Xerces package is renamed because in older Java runtimes where it wasn't (JDK 1.4?), it made it very hard to use a newer version. The license that lets Sun do this is included in the THIRDPARTYLICENSEREADME.txt file that's distributed with Java.

The renamed packages are just there to support JAXP, so you shouldn't compile against them if you need to use internal Xerces code. They could go away in the next version of Java, or be renamed to a different location. Either use the standard JAXP APIs, or include the upstream Xerces jar.

If you really want to know the version, run:
I agree. Here's the link:
subject: No need for Xerces since Sun includes it in the jvm?
It's not a secret anymore!