ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "carmel cohen" <>
Subject Problem with xml-apis.jar located both in the classpath of a taskdef and ant lib.
Date Mon, 08 Jan 2007 13:58:43 GMT

I am trying to write an ant task that uses xml-apis.jar.
My problem is that i want to be able to define what version of
xml-apis.jaris used.
The jar is located both under %ANT_HOME%/lib (and the eclipse's ant lib if
the ant is run from eclipse) and both in my project dir, under a library
called "bin".
so some classes (e.g. org.w3c.dom.Document, also found in the JRE lib-
rt.jar) may appear in more then one location.
The problem is that when i define a task as follows:

*<path id="fileHandler.classpath">
  <pathelement location="./bin/fileHandler.jar"/>
  <pathelement location="./bin/xalan.jar"/>
  <pathelement location="./bin/xercesImpl.jar"/>
  <pathelement location="./bin/xml-apis.jar"/>

<taskdef name="fileHandlerTask"
Then during run time (I am trying to run it both from eclipse and command
line) I am getting NoSuchMethodException due to the fact that the method *
getInputEncoding* defined in Document was only added at xerces v 2.7, and
the Document defined in the JRE lib and under %ANT_HOME%/lib/xml-apis.jar do
not define this method.

My question is whether I can define the order of the jars in the classpath
so that I will be able to make sure that the Classes that are defined in the
*fileHandler.classpath *path will precede the classes defined in the other

Updating the jar at %ANT_HOME%/lib/ is not an option because I want to be
able to run this script from more then one location, so I want to find a
solution that does not require any modifications in the machine that I am
using .

Thanks in advance,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message