Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
does ant modify the requested classpath?

does ant modify the requested classpath?

2003-03-24       - By Pawel Plaszczak
Reply:     1     2     3  

Ant seems to be using a different classpath than I request. I hope someone
can explain the following behavior:

I use java 1.4.1 and Apache Ant version 1.5 compiled on July 11 2002.
Having compiled Axis, I run one of the samples (samples.jms.JMSTest) using
a simple Ant script I wrote. I got this:      
    [java] java.lang.LinkageError: loader constraints violated when
linking org/xml/sax/InputSource class

This looked like Axis the version of org.xml.sax.InputSource was different
than during the compilation. To see what's going on, I made Ant print the
classpath just before running the java task, like this:

 <property name="cp" refid="mypath"/>
 <target name="run">
   <echo message="running, classpath = ${cp}" />
   <java
      classpathref="mypath"
   ....

Analysis of the printed classpath showed that the InputSource being
invoked came from the following jar:
/usr/share/ant/lib/xml-apis.jar :
         1110 Wed Feb 06 10:49:46 CST 2002 org/xml/sax/InputSource.class

However, that's the same jar file that was used during the compilation, so
everything seemed okay.

But then I took the classpath Ant printed, and I run the same class
manually (using java instead of ant), with the same classpath. It went
through fine and did not return the error!

So I am guessing that ant is in fact using different classpath than I tell
it to. In fact, when I run ant -diagnostics, among other information this
was printed:

sun.boot.class.path : ....

Indeed, one jar file from that class path
(/usr/local/j2sdk1.4.1_01/jre/lib/rt.jar) contains another version of the
InputSource class.
However I don't know the meaning of sun.boot.class.path property and if
this information is related to my problem.

Is Ant indeed prepending sun.boot.class.path to the classpath I request?
What is the most reliable way to see what classpath is being eventually
used?

Thanks,
Pawel




©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.